我遇到了以下错误:
$ git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.132' to the list of known hosts.
! Your key with fingerprint b7:fd:15:25:02:8e:5f:06:4f:1c:af:f3:f0:c3:c2:65 is not authorized to access bitstarter.
我尝试添加密钥,但出现以下错误:
$ ssh-add ~/.ssh/id_rsa.pub
Could not open a connection to your authentication agent.
你开始了吗ssh-agent
?
你可能需要开始ssh-agent
在运行之前ssh-add
命令:
eval `ssh-agent -s`
ssh-add
请注意,这将启动代理Windows 上的 msysgit Bash。如果您使用不同的 shell 或操作系统,则可能需要使用该命令的变体,例如其他答案 https://stackoverflow.com/a/20403535/456814.
请参阅以下答案:
- ssh-add 抱怨:无法打开与您的身份验证代理的连接 https://unix.stackexchange.com/questions/48863/ssh-add-complains-could-not-open-a-connection-to-your-authentication-agent/48868#48868
-
Git推送需要用户名和密码 https://stackoverflow.com/questions/6565357/git-push-requires-username-and-password/18348125#18348125(包含如何使用 ssh-agent 的详细说明)
-
如何运行(git/ssh)身份验证代理? https://stackoverflow.com/a/10077302/456814.
- 无法打开与您的身份验证代理的连接 https://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent/17695338#17695338
要自动启动 ssh-agent 并允许单个实例在多个控制台窗口中工作,请参阅登录时启动 ssh-agent https://stackoverflow.com/a/18915067/382458.
为什么我们需要使用eval
而不是仅仅ssh-agent
?
SSH 需要两个东西才能使用 ssh-agent:一个在后台运行的 ssh-agent 实例,以及一个环境变量集,该变量集告诉 SSH 应使用哪个套接字来连接到代理 (SSH_AUTH_SOCK IIRC)。如果您只运行 ssh-agent,那么代理将启动,但 SSH 将不知道在哪里找到它。
from 这条评论 https://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent/4086756#comment35753332_17848593.
公钥与私钥
另外,每当我使用ssh-add
,我总是向其中添加私钥。文件~/.ssh/id_rsa.pub
看起来像公钥,我不确定这是否有效。你有没有~/.ssh/id_rsa
文件?如果您在文本编辑器中打开它,它会说它是私钥吗?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)