我正在尝试使用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上看到错误:检查我何时尝试上限部署
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上失败了:检查?
感谢任何形式的帮助。
答案 0 :(得分:2)
所以你的问题实际上是部署服务器git权限。部署服务器无法进入存储库,因为它的公钥是作为个人密钥添加到之前有权访问存储库但最近撤消了哪个访问权限的帐户,因此部署服务器访问也被撤销。
虽然为什么cap staging deploy
仍然适用于另一个开发者(我),这是一种谜。也许是因为我有哦-my-zsh而且正在做一些魔法代理我的ssh密钥到登台服务器。
实际上,我发现了一个问题,即谷歌搜索我试图为其他开发人员设置部署的错误消息,这很有趣。
所以一般的解决方案是:将人们的部署服务器帐户添加到存储库的“部署密钥”中!不是个人钥匙。