我遇到了以下错误:

$ 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.

当前回答

对于Windows用户,我发现cmd eval“ssh agent-s”不起作用,但使用Git Bash效果不错:

eval `ssh-agent -s`; ssh-add KEY_LOCATION

并确保Windows服务“OpenSSH密钥管理”未被禁用。

其他回答

在我的情况下,我的Comodo防火墙已将ssh代理装箱。一旦我禁用了沙盒,我就能够克隆存储库。

仅供参考,我正在Windows 7上使用Comodo防火墙。

无法打开与身份验证代理的连接

要解决此错误,请执行以下操作:

猛击:

$ eval `ssh-agent -s`

tcsh:

$ eval `ssh-agent -c`

然后像平常一样使用ssh-add。


热门提示:

我总是忘记为上面的ssh代理命令键入什么,所以我在.bashrc文件中创建了一个别名,如下所示:

alias ssh-agent-cyg='eval `ssh-agent -s`'

现在,我可以使用ssh代理cyg代替ssh代理

E.g.

$ ssh-agent-cyg
SSH_AUTH_SOCK=/tmp/ssh-n16KsxjuTMiM/agent.32394; export SSH_AUTH_SOCK;
SSH_AGENT_PID=32395; export SSH_AGENT_PID;
echo Agent pid 32395;
$ ssh-add ~/.ssh/my_pk

原始修复源:

http://cygwin.com/ml/cygwin/2011-10/msg00313.html

对于内置于Windows 10中的Bash,我将其添加到文件.Bash_profile中:

if [ -z $SSH_AUTH_SOCK ]; then
    if [ -r ~/.ssh/env ]; then
            source ~/.ssh/env
            if [ `ps -p $SSH_AGENT_PID | wc -l` = 1 ]; then
                    rm ~/.ssh/env
                    unset SSH_AUTH_SOCK
            fi
    fi
fi

if [ -z $SSH_AUTH_SOCK ]; then
    ssh-agent -s | sed 's/^echo/#echo/'> ~/.ssh/env
    chmod 600 ~/.ssh/env
    source ~/.ssh/env > /dev/null 2>&1
fi

我在尝试下载Git存储库时出错:

无法打开与身份验证代理的连接。ssh添加退出代码2

要消除此错误,请执行以下操作:

使用无密码私钥时,既不需要ssh代理,也不需要ssh add。请参阅将私钥添加到docker文件中的ssh代理。

如果处理得当(使用后删除),无密码私钥不需要使系统不安全。也许这也有助于解决Heroku问题?


这个“把戏”什么时候最重要?在Dockerfile中!

我必须使用无密码私钥来获取Dockerfile以克隆Git存储库,因为在Dockerfile运行期间,无法在shell中输入密码。请参阅Dockerfile:clone repo with passwordless private key。错误:例如,“身份验证代理”或“read_passphrase:无法打开/dev/tty”。最近,还可以考虑使用部署令牌访问Git存储库,而无需手动输入密码。

“代理转发”是一种可以帮助您解决问题的技术。这使得本地SSH密钥在服务器内的活动会话期间“可用”。

如果您在Windows上使用PuTTY,则需要将“Connection/SSSH/Auth/Allow-agent forwarding”选项设置为“true”。