我试图用git bash在Windows机器上部署。以下是我的分阶段。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上看到错误:检查何时尝试盖帽登台exportion
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权限。Deployment Server无法进入存储库,因为它的公共密钥是作为一个以前可以访问存储库但最近撤销的帐户的个人密钥添加的个人密钥,因此也撤销了部署服务器访问权限。
这是一个Mistery,但是为什么cap staging deploy
仍然为另一个开发人员(我)工作。也许是因为我有OH-MY-ZSH,并且在登台服务器的SSH钥匙上做了一些魔术。
实际上,我发现您搜索了我试图为另一个开发人员设置的错误消息,这很有趣。
因此,一般解决方案将是:将您的部署服务器帐户添加到Repository的"部署密钥"中,人们!不适合个人钥匙。