0

我有一个新应用程序,我正在尝试提交到我的 git 帐户。我似乎无法提交:

$ git push origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

$ ssh -T git@github.com
Permission denied (publickey).

$ ssh-add -1
Could not open a connection to your authentication agent.

检查我的 SSH 时,我收到此错误:

$ ssh -vT git@github.com
OpenSSH_6.2p2, OpenSSL 1.0.1e 11 Feb 2013
debug1: Connecting to github.com [204.232.175.90] port 22.
debug1: Connection established.
debug1: identity file /home/Fletch/.ssh/id_rsa type -1
debug1: identity file /home/Fletch/.ssh/id_rsa-cert type -1
debug1: identity file /home/Fletch/.ssh/id_dsa type -1
debug1: identity file /home/Fletch/.ssh/id_dsa-cert type -1
debug1: identity file /home/Fletch/.ssh/id_ecdsa type -1
debug1: identity file /home/Fletch/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-      6+squeeze1+github12
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github12 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/Fletch/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
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: Trying private key: /home/Fletch/.ssh/id_rsa
debug1: Trying private key: /home/Fletch/.ssh/id_dsa
debug1: Trying private key: /home/Fletch/.ssh/id_ecdsa
debug1: No more authentication methods to try.
Permission denied (publickey).

我有一个 GIT 帐户,我有他们的本地客户端,并且我有一个附加的 SSH 密钥,其中创建了 id_rsa.pub 文件,我创建了我的全局用户设置,我在 GitHub 中创建了一个存储库,我在 Cygwin 中有所有相关的 SSH 代理安装后,我在安装 Cygwin 和使用终端时禁用了所有防火墙产品。

我唯一可以解决的问题是:

$ ssh-keygen -lf ~/.ssh/id_rsa.pub
/home/Fletch/.ssh/id_rsa.pub: No such file or directory

但是,我创建了这个文件并在我的帐户中看到了 SSH 密钥。我搜索了所有类似的帖子,似乎找不到问题。

4

2 回答 2

0

我将 cygwin 与 github 和 bitbucket 一起使用,并且在我阅读为 Git 设置 SSH之前遇到了类似的问题

它展示了如何设置 ssh 密钥以及如何在您第一次启动 bash(或 Git Bash)时自动运行 ssh-agent。

于 2013-06-11T10:53:58.787 回答
0

在另一篇文章中找到了答案:GitHub:权限被拒绝(公钥)。致命:远端意外挂断

我遇到了这个问题,但上面的解决方案都没有奏效。我可以克隆和获取但无法推送。最终,我发现问题出在我的 .git/config 中的 url 中,它应该是:git@github.com:/(不是 ssh://github.com//.git 或https://github.com //.git )。

于 2013-06-11T21:35:30.703 回答