2016-03-04 87 views
0

我是初學者,Rails,GitCapistrano試圖部署我的第一個應用程序。通過SSH連接到使用Capistrano的Bitbucket時出錯

我已經安裝了一個VPS,安裝了Ubuntu,NginxUnicorn,現在想用Capistrano進行部署。我的應用存儲在Bitbucket存儲庫中。

爲了檢查我是否正確設置Capistrano我運行了以下命令。

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

然而這些,給了我以下錯誤:

INFO [c65cf8c7] Running /usr/bin/env mkdir -p /tmp/testapp/ as [email protected][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. 
[email protected][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 [email protected][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 [email protected]:[USER]/testapp.git as [email protected][IP] 
DEBUG [b0c6add8] Command: (export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/testapp/git-ssh.sh" ; /usr/bin/env git ls-remote --heads [email protected]:[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 [email protected][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) 

好像不順心的事與SSH認證,標準Git命令爲pushpull我的混帳存儲庫工作正常。

格羅姆我的本地機器$ ssh -T [email protected]告訴我:

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. 

從我[email protected]帳戶:ssh -T [email protected]

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

任何想法的?

回答

1

Capistrano試圖在部署目標處檢出git存儲庫,即在VPS。因此,您需要獲得從VPS機器上的bitbucket的ssh連接。

我想你的ssh身份在你的本地主機和VPS上是不同的,而且你只配置了本地機器的ssh密鑰在bitbucket中。

您可以在您的本地機器上比較~/.ssh/id_rsa.pub,並在您的VPS上登錄爲developer?如果密鑰不同,則需要將VPS中的公用ssh密鑰(id_rsa.pub文件)添加到bitbucket配置,以便您可以使用ssh從VPS連接到bitbucket。

+0

謝謝。而已。我仍然收到錯誤:'錯誤讀取身份驗證套接字的響應長度,但它現在成功完成。乾杯! – Matthias