【问题标题】:Capistrano deploy with bitbucket - Permission denied (publickey)Capistrano 使用 bitbucket 部署 - 权限被拒绝(公钥)
【发布时间】:2015-06-11 13:45:48
【问题描述】:

将公钥添加到bitbucket 帐户后,ssh -T git@bitbucket.org 返回(在 Windows 中):

The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
RSA key fingerprint is 65:8c:1b:f2:6f:91:6b:5c:3b:ec:4a:46:46:74:7z:40.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bitbucket.org' (RSA) to the list of known hosts.
logged in as myusername.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

我们确认bitbucket.org 已添加到known_hostscap deploy 命令返回:

Host key verification failed.
fatal: The remote end hung up unexpectedly

我们在deploy.rb 文件中添加了以下两行:

ssh_options[:forward_agent] = true
default_run_options[:pty] = true

现在cap deploy 返回错误:

 Permission denied (publickey).

密钥不受密码保护。如果密钥被bitbucket接受(ssh -T返回正确的信息),为什么我们仍然有Permission denied的错误。

【问题讨论】:

    标签: git ssh bitbucket


    【解决方案1】:

    您是否在远程服务器上运行了ssh -T git@bitbucket.org 命令并在那里确认?我刚刚检查了我使用 Capistrano 部署到的 Linux 服务器,并且 bitbucket.org 列在部署用户的 .ssh/known_hosts 文件中(它是散列的,但 ssh-keygen -F bitbucket.org 显示了它)。

    Capistrano SSH 进入远程服务器,并从那里运行 git checkout。它需要权限才能连接到 Bitbucket,尽管访问权限是从源计算机通过:forward_agent 选项授予的。

    【讨论】:

    • @Alister Bulman, ssh -T git@bitbucket.org 在远程服务器上返回permission denied,你是对的。我们是否需要在远程服务器上添加密钥并将其私钥添加到 bitbucket?
    • 您只需要确认主机的真实性 - 它很可能会失败,因为您没有在简单的 SSH 登录时转发密钥,但是使用 Capistrano 和转发代理应该会做得更好。
    • 刚刚做了,效果很好。我没有意识到除了部署PC之外,bitbucket还需要对远程服务器进行身份验证(github只需要对部署PC进行身份验证)。再次感谢!
    猜你喜欢
    • 1970-01-01
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    • 2013-12-13
    • 1970-01-01
    • 2014-01-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多