使用 ssh-agent 设置 ssh 进行部署,问题遵循 capistranorb.com 的说明

set up ssh with ssh-agent for deployment, Problem following instruction from capistranorb.com

我正在尝试遵循 capistranorb.com 上有关身份验证和授权的文档,但他们使用 github,我使用 bitbucket。有一个地方卡住了,因为控制台的输出不同。

文章中描述的生产服务器上存在名为 deploy 的用户。我可以ssh到他的帐户。 bitbucket 中的 repo 设置正确。我的一位同事可以毫无问题地部署该项目,所以问题出在我个人的密钥设置上。我尝试按照 https://capistranorb.com/documentation/getting-started/authentication-and-authorisation/ 上的说明进行操作。一步不行。

当我做的时候

My-MacBook-Pro-2:myproject myuser$ git config remote.origin.url

输出是

https://MyBitbucketUser@bitbucket.org/myfirm/myproject.git

关于 capistranorb 的文章说它应该是

git@github.com:capistrano/rails3-bootstrap-devise-cancan.git

所以那里没有 https,它说 git@。

他们文档中的以下命令是

ssh -A deploy@one-of-my-servers.com 'git ls-remote git@github.com:capistrano/rails3-bootstrap-devise-cancan.git'

现在当我做

ssh -A deploy@myproject.net 'git ls-remote https://MyBitbucketUser@bitbucket.org/myfirm/myproject.git'

我得到一个错误,如果我省略了 https:// 位。

如果我包含 https://,我会得到错误 "fatal: could not read Password for 'https://DcsMarionDickten@bitbucket.org': No such device or address",如果我不包含,我会得到“... does not appear to be a git repository”。

我应该补充一点,我已经设置 git 推送到 bitbucket 而无需它要求我输入密码,我已经将我的 public 密钥添加到帐户中,这似乎有效。

这里有什么问题?

(我或许应该补充一点,我正在解决一个问题,因为我的同事使用 ssh-agent 转发 ssh 密钥授权,而我的密钥设置没有密码,因为我不知道你需要一个。)

ssh-agent 无法理解基于 HTTPS 的 URLs。您需要指定 SSH URL,例如 MyBitbucketUser@bitbucket.org:myfirm/myproject.git。 (git@bitbucket.org:myfirm/myproject.gitssh://MyBitbucketUser@bitbucket.org/myfirm/myproject.git 一样有效。)