经过大量的谷歌搜索和故障排除后,我相信我已经确定 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>
现在它可以工作了。谢谢!