4

经过大量的谷歌搜索和故障排除后,我相信我已经确定 Cygwin 在 SSH 时不会发送其 SSH 私钥,除非你明确告诉它。我可以在我的 SSH 配置文件中使用 IdentityFile 行来执行此操作,但我也不知道在使用 git 时如何让它执行此操作。

这一次,我专门尝试推送到 GitHub。我的 SSH 密钥已添加。以前,在设置配置文件并添加 IdentityFile 行之前,我无法通过 SSH 登录。现在我可以成功 SSH 到 GitHub,但不能 git push。

有谁知道如何解决这个问题?

万分感谢!

编辑:要清楚,当我尝试 git push 时,我收到以下错误:

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

但我可以 SSH 就好了:

$ ssh github
Hi ______! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

Edit2 与解决方案:

用户 'Cupcake' 建议将我的密钥添加到 ssh-agent。我跑了:

$ ssh-add <private key path>

现在它可以工作了。谢谢!

4

1 回答 1

1

我个人使用PuttyCyg将 Putty 直接安装到我的 Cygwin 安装中。这样做的好处是让我可以访问 Putty 的 ssh 实现,以及 Putty 的终端,我发现它比 Cygwin 的更容易配置且错误更少。

有关如何设置 PuttyCyg 的说明列表以及一些注释和配置文件,请参阅 Effective -cygwin GitHub 页面。

于 2013-09-26T18:10:10.560 回答