git id_rsa key过期

本文介绍了GitHub升级安全策略后,如何通过生成新的SSH密钥并将其添加到GitHub账号中来实现安全登录。同时提供了使用SSH方式克隆仓库的具体步骤。

原因

github升级安全策略, 不再使用id_rsa和密码登录.

解决办法

使用安全度更好的key

# 1. 生成sshkey
ssh-keygen -t ecdsa -b 521
# 2. 将生成的pub key添加到github的key中
# 3. 使用ssh的方式clone
git clone git@github.com:YongfeiYan/lessdl.git
GJCKGD09064:~ 10280281$ ssh -Tv git@gitlab.com OpenSSH_9.9p1, LibreSSL 3.3.6 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Reading configuration data /etc/ssh/ssh_config.d/100-macos.conf debug1: /etc/ssh/ssh_config.d/100-macos.conf line 1: Applying options for * debug1: Reading configuration data /etc/ssh/crypto.conf debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling debug1: Connecting to gitlab.com port 22. debug1: Connection established. debug1: identity file /Users/10280281/.ssh/id_rsa type -1 debug1: identity file /Users/10280281/.ssh/id_rsa-cert type -1 debug1: identity file /Users/10280281/.ssh/id_ecdsa type -1 debug1: identity file /Users/10280281/.ssh/id_ecdsa-cert type -1 debug1: identity file /Users/10280281/.ssh/id_ecdsa_sk type -1 debug1: identity file /Users/10280281/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /Users/10280281/.ssh/id_ed25519 type 3 debug1: identity file /Users/10280281/.ssh/id_ed25519-cert type -1 debug1: identity file /Users/10280281/.ssh/id_ed25519_sk type -1 debug1: identity file /Users/10280281/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /Users/10280281/.ssh/id_xmss type -1 debug1: identity file /Users/10280281/.ssh/id_xmss-cert type -1 debug1: identity file /Users/10280281/.ssh/id_dsa type -1 debug1: identity file /Users/10280281/.ssh/id_dsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_9.9 debug1: Remote protocol version 2.0, remote software version GitLab-SSHD debug1: compat_banner: no match: GitLab-SSHD debug1: Authenticating to gitlab.com:22 as 'git' debug1: load_hostkeys: fopen /Users/10280281/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: ecdh-sha2-nistp256 debug1: kex: host key algorithm: ssh-ed25519 debug1: kex: server->client cipher: aes128-gcm@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: aes128-gcm@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: SSH2_MSG_KEX_ECDH_REPLY received debug1: Server host key: ssh-ed25519 SHA256:eUXGGm1YGsMAS7vkcx6JOJdOGHPem5gQp4taiCfCLB8 debug1: load_hostkeys: fopen /Users/10280281/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: Host 'gitlab.com' is known and matches the ED25519 host key. debug1: Found key in /Users/10280281/.ssh/known_hosts:2 debug1: ssh_packet_send2_wrapped: resetting send seqnr 3 debug1: rekey out after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: ssh_packet_read_poll2: resetting read seqnr 3 debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 4294967296 blocks debug1: SSH2_MSG_EXT_INFO received debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512,ssh-rsa,ssh-dss> debug1: kex_ext_info_check_ver: ping@openssh.com=<0> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: get_agent_identities: bound agent to hostkey debug1: get_agent_identities: agent returned 1 keys debug1: Will attempt key: /Users/10280281/.ssh/id_ed25519 ED25519 SHA256:SuAWMQGFny0Fbbb0v4XrQfli2ahKRO7GFDPQ+kRiSUU agent debug1: Will attempt key: /Users/10280281/.ssh/id_rsa debug1: Will attempt key: /Users/10280281/.ssh/id_ecdsa debug1: Will attempt key: /Users/10280281/.ssh/id_ecdsa_sk debug1: Will attempt key: /Users/10280281/.ssh/id_ed25519_sk debug1: Will attempt key: /Users/10280281/.ssh/id_xmss debug1: Will attempt key: /Users/10280281/.ssh/id_dsa debug1: Offering public key: /Users/10280281/.ssh/id_ed25519 ED25519 SHA256:SuAWMQGFny0Fbbb0v4XrQfli2ahKRO7GFDPQ+kRiSUU agent debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/10280281/.ssh/id_rsa debug1: Trying private key: /Users/10280281/.ssh/id_ecdsa debug1: Trying private key: /Users/10280281/.ssh/id_ecdsa_sk debug1: Trying private key: /Users/10280281/.ssh/id_ed25519_sk debug1: Trying private key: /Users/10280281/.ssh/id_xmss debug1: Trying private key: /Users/10280281/.ssh/id_dsa debug1: No more authentication methods to try. git@gitlab.com: Permission denied (publickey).
08-14
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值