如何通过代理转发停止 ssh-agent 尝试所有密钥?

Ste*_*ude 8 ssh ssh-agent

通常我会通过 SSH 连接到 VM 实例,从私有 Bitbucket 存储库部署代码,通过 SSH 通过 git 克隆存储库。今天我收到错误:

conq: repository access denied. deployment key is not associated with the requested repository.

快速搜索显示这是Repository access denied 中描述的问题通过部署密钥访问是只读的。问题是我转发的 SSH 代理试图使用 Vagrant 开发密钥连接到 Bitbucket,这是我上次尝试通过 SSH 克隆私有存储库后添加的。(从我的.ssh目录中删除 Vagrant 密钥允许我再次访问私有存储库。)

我的 SSH config是:

托管 bitbucket.org
  用户 git
  IdentityFile ~/.ssh/bitbucket_key
  身份只有是

并且在本地这似乎表现得如预期。ssh -v git@bitbucket.org节目输出

debug1:可以继续的身份验证:publickey
debug1:下一个身份验证方法:publickey
debug1:提供 RSA 公钥:/home/me/.ssh/bitbucket_key

而当我通过 SSH 连接到另一台服务器时:

debug1:提供 RSA 公钥:steve@not_a_bitbucket_key
debug1:可以继续的身份验证:publickey
debug1:提供 RSA 公钥:steve@still_not_a_bitbucket_key
debug1:可以继续的身份验证:publickey
debug1:提供 RSA 公钥:steve@bitbucket_key

除了IdentitiesOnly我缺少确保在使用代理转发时仅将请求的密钥发送到特定服务器之外,还有其他配置吗?

运行安装了 OpenSSH 5.9p1 的 Ubuntu 12.04。

dev*_*ull 1

您是否尝试添加ForwardAgent no主机 bitbucket 的 ssh 配置文件?

有用的来源: https://developer.github.com/guides/using-ssh-agent-forwarding/ https://support.ssh.com/manuals/server-zos-admin/55/Disabling_Agent_Forwarding.html

编辑:我重读了你的问题的标题(抱歉我刚刚醒来),但是ForwardAgent no如果你不希望它发送到你 ssh 到的每台机器,请添加到所有主机的配置中,并且只需添加到ForwardAgent yes你希望 ssh 代理转发到的主机积极点。