【发布时间】:2020-07-04 01:01:57
【问题描述】:
我正在尝试将我的 Gitlab 存储库转移到 Github,但是当我尝试将其推送(根据各种指南)时,我总是收到错误:Permission denied (publickey).
我已经通过 Github 教程多次在本地添加 SSH 密钥然后到我的 Github 帐户,但它仍然不起作用。这是一些不同命令的输出。
(我已经做了keygen命令)
$ eval "$(ssh-agent -s)"
Agent pid 84168
$ ssh-add -l -E md5
The agent has no identities.
$ ssh-add ~/.ssh/id_rsa
Enter passphrase for /Users/isaiahmayerchak/.ssh/id_rsa: <my-passphrase>
Identity added: /Users/isaiahmayerchak/.ssh/id_rsa (/Users/isaiahmayerchak/.ssh/id_rsa)
$ ssh-add -l -E md5
4096 MD5:0c:44:3d:28:de:17:71:e5:29:18:bf:a1:8c:8j:mf:3c /Users/isaiahmayerchak/.ssh/id_rsa (RSA)
$ ssh -vT git@github.com
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/isaiahmayerchak/.ssh/config
debug1: /Users/isaiahmayerchak/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to github.com [192.30.253.113] port 22.
debug1: Connection established.
debug1: identity file /Users/isaiahmayerchak/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/isaiahmayerchak/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/isaiahmayerchak/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/isaiahmayerchak/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/isaiahmayerchak/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/isaiahmayerchak/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/isaiahmayerchak/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/isaiahmayerchak/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/isaiahmayerchak/.ssh/known_hosts:9
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/isaiahmayerchak/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/isaiahmayerchak/.ssh/id_dsa
debug1: Trying private key: /Users/isaiahmayerchak/.ssh/id_ecdsa
debug1: Trying private key: /Users/isaiahmayerchak/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
在 Github 上,我添加的 SSH 密钥与我的本地密钥完全匹配,但在 Github 上它说它尚未使用。
我已经为我的用户名和电子邮件设置了 github 配置。我也尝试过ssh -i ~/.ssh/id_rsa -vT git@github.com
,但这对我也没有任何好处。我真的需要在接下来的 2 天内转移此存储库以进行工作。我看过的故障排除文章都没有帮助;他们都认为ssh -vT git@github.com 会在他们的步骤之后工作,但它不适合我。有人可以帮我吗?
【问题讨论】:
-
您可以尝试手动添加吗?
-
您是否添加了密钥或指纹?
-
我不确定指纹是什么,但是我已经手动将密钥添加到Github(我添加密钥的唯一方法是手动)
标签: git github ssh terminal gitlab