在Windows上部署Capistrano失败与git
问题描述:
我想部署在Windows机器与git bash。 以下是我的staging.rb文件。在Windows上部署Capistrano失败与git
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 [email protected]
ssh -A [email protected] 'git ls-remote --heads [email protected]:<user>/<repo>.git'
git pull origin staging
的问题是我看到错误的混帐:检查时,我想盖分期部署
INFO [548342cf] Running /usr/bin/env mkdir -p /tmp/butlermaps/ as [email protected]
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
[email protected]
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 [email protected]:<user>/<repo>.git
as [email protected]
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]:
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 [email protected]:
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权限。部署服务器无法进入存储库,因为它的公钥是作为个人密钥添加到之前有权访问存储库的帐户的,但最近撤消了哪些访问权限,因此部署服务器访问也被撤销。
虽然cap staging deploy
仍然为另一个开发者(我)工作,这是一个神秘的。也许是因为我有了oh-my-zsh,它正在为我的SSH密钥代理服务器。
其实,我发现你用Google搜索错误信息的问题,我试图为其他开发者设置部署,这很有趣。
因此,一般的解决方案是:将您的部署服务器帐户添加到存储库的“部署密钥”中,人员!不要私人钥匙。
它像魅力一样工作!非常感谢伊戈尔。 – sean