簡體   English   中英

使用git在Windows上部署Capistrano失敗

[英]Capistrano deploy on windows fails with git

我試圖用git bash在windows機器上部署。 下面是我的staging.rb文件。

set :stage, :staging
set :chruby_ruby, '2.2'
set :rails_env, :staging

#set :branch, '15_inaccurate-line-on-map'
set :branch, 'staging'

set :ssh_options, {
    forward_agent: true
}

set :rvm_roles, [:some]
set :rvm_map_bins, []

server 'XX.XX.XX.XX', user: 'deploy', roles: %w(web app db)

存儲庫位於bitbucket上。 我在bitbucket和服務器上添加了我的密鑰。 因此,當我嘗試使用bash時,這些命令是成功的。

ssh deploy@XX.XX.XX.XX

ssh -A deploy@xx.xx.xx.xx 'git ls-remote --heads git@bitbucket.org:<user>/<repo>.git'

git pull origin staging

問題是我在git上看到錯誤:檢查我何時嘗試cap staging deploy

INFO [548342cf] Running /usr/bin/env mkdir -p /tmp/butlermaps/ as deploy@xx.xx.xx.xx
INFO [548342cf] Finished in 3.145 seconds with exit status 0 (successful).
INFO Uploading /tmp/butlermaps/git-ssh.sh 100.0%
INFO [2f19d649] Running /usr/bin/env chmod +x /tmp/butlermaps/git-ssh.sh as depl
oy@xx.xx.xx.xx
INFO [2f19d649] Finished in 0.487 seconds with exit status 0 (successful).
** Execute git:check
INFO [61e3a414] Running /usr/bin/env git ls-remote --heads git@bitbucket.org:<user>/<repo>.git
 as deploy@xx.xx.xx.xx
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xx.xx.xx.xx:
git exit status: 128
git stdout: Nothing written
git stderr: Error reading response length from authentication socket.
conq: repository access denied.
fatal: The remote end hung up unexpectedly
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.
rb:16:in `rescue in block (2 levels) in execute'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.
rb:12:in `block (2 levels) in execute'
SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: Error reading response length from authentication socket.
conq: repository access denied.
fatal: The remote end hung up unexpectedly
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/command.rb:95:in
`exit_status='
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.r
b:179:in `block in _execute'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.r
b:133:in `tap'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.r
b:133:in `_execute'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.r
b:66:in `execute'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/capistrano-3.4.0/lib/capistrano/git.rb:11
:in `git'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/capistrano-3.4.0/lib/capistrano/git.rb:21
:in `check'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/capistrano-3.4.0/lib/capistrano/tasks/git
.rake:28:in `block (4 levels) in <top (required)>'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/backends/abstract
.rb:85:in `with'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/capistrano-3.4.0/lib/capistrano/tasks/git
.rake:27:in `block (3 levels) in <top (required)>'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.r
b:54:in `instance_exec'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.r
b:54:in `run'
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.
rb:13:in `block (2 levels) in execute'
Tasks: TOP => git:check
The deploy has failed with an error: Exception while executing as deploy@xx.xx.xx.xx: 
git exit status: 128
git stdout: Nothing written
git stderr: Error reading response length from authentication socket.
conq: repository access denied.
fatal: The remote end hung up unexpectedly
** Invoke deploy:failed (first_time)
** Execute deploy:failed

任何人都知道為什么它在git上失敗了:檢查?

任何形式的幫助表示贊賞。

所以你的問題實際上是部署服務器git權限。 部署服務器無法進入存儲庫,因為它的公鑰是作為個人密鑰添加到之前有權訪問存儲庫但最近撤消了哪個訪問權限的帳戶,因此部署服務器訪問也被撤銷。

雖然為什么cap staging deploy仍然適用於另一個開發人員(我),這是一個謎。 也許是因為我有哦-my-zsh而且正在做一些魔法代理我的ssh密鑰到登台服務器。

實際上,我發現這個問題你在谷歌上搜索我試圖為另一個開發人員設置部署的錯誤信息,這很有趣。

所以一般的解決方案是:將人們的部署服務器帳戶添加到存儲庫的“部署密鑰”中! 不是個人鑰匙。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM