【问题标题】:Error connecting via SSH to Bitbucket using Capistrano使用 Capistrano 通过 SSH 连接到 Bitbucket 时出错
【发布时间】:2016-03-05 18:17:31
【问题描述】:

我是 RailsGitCapistrano 尝试部署我的第一个应用程序的初学者。

我已经设置了一个安装了UbuntuNginxUnicorn 的VPS,现在希望使用Capistrano 进行部署。我的应用程序存储在 Bitbucket 存储库中。

为了检查我是否正确设置了Capistrano,我运行了以下命令。

$ cap production git:check$ cap production deploy:check

然而,这些给了我以下错误:

INFO [c65cf8c7] Running /usr/bin/env mkdir -p /tmp/testapp/ as developer@[IP]
DEBUG [c65cf8c7] Command: /usr/bin/env mkdir -p /tmp/testapp/
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
developer@[IP]'s password: [password]
INFO [c65cf8c7] Finished in 31.340 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/testapp/git-ssh.sh 0.0%
INFO Uploading /tmp/testapp/git-ssh.sh 100.0%
INFO [2dbfc686] Running /usr/bin/env chmod +x /tmp/testapp/git-ssh.sh as developer@[IP]
DEBUG [2dbfc686] Command: /usr/bin/env chmod +x /tmp/testapp/git-ssh.sh
INFO [2dbfc686] Finished in 0.017 seconds with exit status 0 (successful).
INFO [b0c6add8] Running /usr/bin/env git ls-remote --heads git@bitbucket.org:[USER]/testapp.git as developer@[IP]
DEBUG [b0c6add8] Command: ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/testapp/git-ssh.sh" ; /usr/bin/env git ls-remote --heads git@bitbucket.org:[USER]/testapp.git )
DEBUG [b0c6add8]        Warning: Permanently added 'bitbucket.org,104.192.143.3' (RSA) to the list of known hosts.
DEBUG [b0c6add8]        Error reading response length from authentication socket.
DEBUG [b0c6add8]        Permission denied (publickey).
DEBUG [b0c6add8]        fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as developer@[IP]: git exit status: 128
git stdout: Nothing written
git stderr: Warning: Permanently added 'bitbucket.org,104.192.143.3' (RSA) to the list of known hosts.
Error reading response length from authentication socket.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: Warning: Permanently added 'bitbucket.org,104.192.143.3' (RSA) to the list of known hosts.
Error reading response length from authentication socket.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Tasks: TOP => git:check
(See full trace by running task with --trace)

我的 git 存储库中的 SSH 身份验证、标准 git 命令(如 pushpull)似乎出了点问题。

从我的本地机器$ ssh -T git@bitbucket.com 告诉我:

Warning: Permanently added the RSA host key for IP address '104.192.143.7' to the list of known hosts.
logged in as [USER].  
You can use git or hg to connect to Bitbucket. Shell access is disabled.

来自我的developer@vps 帐户:ssh -T git@bitbucket.com

Warning: Permanently added the RSA host key for IP address '104.192.143.7' to the list of known hosts.
Permission denied (publickey).

有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails git ssh


    【解决方案1】:

    Capistrano 尝试在 部署目标(即 VPS)签出 git 存储库。因此,您需要从 VPS 机器获得到 bitbucket 的 ssh 连接。

    我猜你的 ssh 身份在本地主机和 VPS 上是不同的,并且你只在 bitbucket 中配置了本地机器 ssh 密钥。

    您能否比较本地计算机上的~/.ssh/id_rsa.pub 和在您的VPS 上登录为developer 的情况?如果密钥不同,您需要将 VPS 中的公共 ssh 密钥(id_rsa.pub 文件)添加到 bitbucket 配置中,以便您可以使用 ssh 从您的 VPS 连接到 bitbucket。

    【讨论】:

    • 谢谢。而已。我仍然收到错误:Error reading response length from authentication socket,但它现在成功完成。干杯!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-28
    • 1970-01-01
    • 2018-11-01
    • 1970-01-01
    • 2020-02-15
    • 2021-04-19
    相关资源
    最近更新 更多