如何修复capistrano部署?git退出状态:1

Ste*_*olf 4 capistrano ruby-on-rails

我在我的应用程序中使用了Capistrano 3.2.1和Rails 4.0.我正在尝试从我的github repo安装gem.但它不起作用.我不知道是怎么回事.当我ssh -T git@github.com在我的服务器上运行时它会成功.但是当我跑步时,cap production deploy我得到以下错误:

DEBUG [d89fd157]  000a0d807aabdb327d80bbe21d5212e62142f9ca  refs/tags/staging-2014-05-22-15-58-38-0400^{}
DEBUG [d89fd157]  1cbcc8350316c7511035f1ef85f1f8d177197a24  refs/tags/staging-2014-05-22-16-55-02-0400
DEBUG [d89fd157]  5e905411ca362abe83fdbfbb4aa81222945dcecc  refs/tags/staging-2014-05-22-16-55-02-0400^{}
DEBUG [d89fd157]  fa200661a9791aefa41318a54c3fee477a246ece  refs/tags/staging-2014-05-22-20-01-16-0400
DEBUG [d89fd157]  665fd3d871e75f6b092c11572c23e126d139d9d9  refs/tags/staging-2014-05-22-20-01-16-0400^{}
DEBUG [d89fd157]  84b23c1e93c47d91d4a442866d83a9e275428369  refs/tags/staging-2014-05-23-11-27-24-0400
DEBUG [d89fd157]  10a2c4dab3e76eb05ba07b18392f92bcc7e30ccf  refs/tags/staging-2014-05-23-11-27-24-0400^{}
DEBUG [d89fd157]  b7ca8b7bcad98e4160deb06df6688153e372f658  refs/tags/staging-2014-05-28-22-48-47-0530
DEBUG [d89fd157]  f69bf3a92ad5ef65cb9425428be0446c2459143a  refs/tags/staging-2014-05-28-22-48-47-0530^{}
DEBUG [d89fd157]  62a2a29e5c88e3603666826421cb1ea28f78423c  refs/tags/staging-2014-05-29-00-46-10-0530
DEBUG [d89fd157]  f69bf3a92ad5ef65cb9425428be0446c2459143a  refs/tags/staging-2014-05-29-00-46-10-0530^{}
DEBUG [d89fd157]  960e24c40e0ab7207f92812f34015ae41a307e7e  refs/tags/staging-2014-05-29-00-51-04-0530
DEBUG [d89fd157]  f69bf3a92ad5ef65cb9425428be0446c2459143a  refs/tags/staging-2014-05-29-00-51-04-0530^{}
DEBUG [d89fd157] Finished in 2.876 seconds with exit status 0 (successful).
 INFO [dc211684] Running /usr/bin/env mkdir -pv /data/apps/myautobrain/shared /data/apps/myautobrain/releases on 107.170.168.224
DEBUG [dc211684] Command: ( RAILS_ENV=staging RBENV_ROOT=/data/rbenv RBENV_VERSION=2.1.1 /usr/bin/env mkdir -pv /data/apps/myautobrain/shared /data/apps/myautobrain/releases )
 INFO [dc211684] Finished in 1.669 seconds with exit status 0 (successful).
 INFO [3b633fa7] Running /usr/bin/env mkdir -pv /data/apps/myautobrain/shared/log /data/apps/myautobrain/shared/tmp /data/apps/myautobrain/shared/vendor/bundle /data/apps/myautobrain/shared/db/backups /data/apps/myautobrain/shared/config/settings on 107.170.168.224
DEBUG [3b633fa7] Command: ( RAILS_ENV=staging RBENV_ROOT=/data/rbenv RBENV_VERSION=2.1.1 /usr/bin/env mkdir -pv /data/apps/myautobrain/shared/log /data/apps/myautobrain/shared/tmp /data/apps/myautobrain/shared/vendor/bundle /data/apps/myautobrain/shared/db/backups /data/apps/myautobrain/shared/config/settings )
 INFO [3b633fa7] Finished in 1.646 seconds with exit status 0 (successful).
 INFO [1581b4a0] Running /usr/bin/env mkdir -pv /data/apps/myautobrain/shared/config on 107.170.168.224
DEBUG [1581b4a0] Command: ( RAILS_ENV=staging RBENV_ROOT=/data/rbenv RBENV_VERSION=2.1.1 /usr/bin/env mkdir -pv /data/apps/myautobrain/shared/config )
 INFO [1581b4a0] Finished in 1.691 seconds with exit status 0 (successful).
DEBUG [48a6c211] Running /usr/bin/env [ -f /data/apps/myautobrain/shared/config/database.yml ] on 107.170.168.224
DEBUG [48a6c211] Command: [ -f /data/apps/myautobrain/shared/config/database.yml ]
DEBUG [48a6c211] Finished in 1.676 seconds with exit status 0 (successful).
DEBUG [0a11405e] Running /usr/bin/env [ -f /data/apps/myautobrain/shared/config/database.yml ] on 107.170.168.224
DEBUG [0a11405e] Command: [ -f /data/apps/myautobrain/shared/config/database.yml ]
DEBUG [0a11405e] Finished in 1.575 seconds with exit status 0 (successful).
DEBUG [2c1a88cc] Running /usr/bin/env [ $(which nodejs || which node ) ] on 107.170.168.224
DEBUG [2c1a88cc] Command: [ $(which nodejs || which node ) ]
DEBUG [2c1a88cc] Finished in 1.560 seconds with exit status 0 (successful).
 INFO Javascript runtime nodejs is available on 107.170.168.224
DEBUG [5c2090dd] Running /usr/bin/env [ $(which identify) ] on 107.170.168.224
DEBUG [5c2090dd] Command: [ $(which identify) ]
DEBUG [5c2090dd] Finished in 1.643 seconds with exit status 0 (successful).
 INFO Javascript runtime nodejs is available on 107.170.168.224
DEBUG [51feab0b] Running /usr/bin/env [ -f /data/apps/myautobrain/repo/HEAD ] on 107.170.168.224
DEBUG [51feab0b] Command: [ -f /data/apps/myautobrain/repo/HEAD ]
DEBUG [51feab0b] Finished in 1.620 seconds with exit status 0 (successful).
 INFO The repository mirror is at /data/apps/myautobrain/repo
DEBUG [60a484d1] Running /usr/bin/env if test ! -d /data/apps/myautobrain/repo; then echo "Directory does not exist '/data/apps/myautobrain/repo'" 1>&2; false; fi on 107.170.168.224
DEBUG [60a484d1] Command: if test ! -d /data/apps/myautobrain/repo; then echo "Directory does not exist '/data/apps/myautobrain/repo'" 1>&2; false; fi
DEBUG [60a484d1] Finished in 1.592 seconds with exit status 0 (successful).
DEBUG [be3246e2] Running /usr/bin/env cd /data/apps/myautobrain/repo && git rev-parse --short HEAD on 107.170.168.224
DEBUG [be3246e2] Command: cd /data/apps/myautobrain/repo && git rev-parse --short HEAD
DEBUG [be3246e2]  3dbe0cd
DEBUG [be3246e2]  
DEBUG [be3246e2] Finished in 0.194 seconds with exit status 0 (successful).
 INFO [375571f4] Running /usr/bin/env git remote update on 107.170.168.224
DEBUG [375571f4] Command: cd /data/apps/myautobrain/repo && ( RAILS_ENV=staging RBENV_ROOT=/data/rbenv RBENV_VERSION=2.1.1 GIT_ASKPASS=/bin/echo GIT_SSH=/data/tmp/myautobrain/git-ssh.sh /usr/bin/env git remote update )
DEBUG [375571f4]  Fetching origin
DEBUG [375571f4]  
DEBUG [375571f4]  ERROR: Repository not found.
DEBUG [375571f4]  
DEBUG [375571f4]  fatal: The remote end hung up unexpectedly
DEBUG [375571f4]  
DEBUG [375571f4]  error: Could not fetch origin
DEBUG [375571f4]  
cap aborted!
git exit status: 1
git stdout: Nothing written
git stderr: Nothing written

Tasks: TOP => git:create_release => git:update
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: git exit status: 1
git stdout: Nothing written
git stderr: Nothing written
>
Run Code Online (Sandbox Code Playgroud)

这是deploy.rb:

set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, '2.1.1'

#TODO: Check the application name
set :application, 'myautobrain'

#TODO: Replace with valid github url
set :repo_url, 'git@github.com:swjg-ventures/myautobrain.git'

ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }

set :deploy_to, "/data/apps/#{fetch(:application)}"
set :scm, :git

set :format, :pretty
set :log_level, :debug
set :pty, true

set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{log tmp vendor/bundle db/backups config/settings}

# set :default_env, { path: "/opt/ruby/bin:$PATH" }
set :keep_releases, 5

set :bundle_without, %w{development test utils}.join(' ')

set :git_tag_name, proc { Time.now.to_s.gsub(/[-\s\:\+]+/, '-') }

before 'deploy:migrate', 'db:backup'
after 'deploy:finishing', 'deploy:restart'
after 'deploy:finishing', 'deploy:cleanup'
Run Code Online (Sandbox Code Playgroud)

从服务器:

deployer@myautobrain-staging:~$ ls -l ~/.ssh
total 20
-rw------- 1 deployer deployer 4815 May 28 17:57 authorized_keys
-rw------- 1 deployer deployer 1675 May 28 17:29 id_rsa
-rw-r--r-- 1 deployer deployer  404 May 28 17:29 id_rsa.pub
-rw-r--r-- 1 deployer deployer 2210 May 28 13:17 known_hosts
Run Code Online (Sandbox Code Playgroud)

这个过程中最令人沮丧的部分是这个过程适用于我的同事计算机.

任何的想法?如果您需要更多信息,请告诉我们.

dan*_*dds 5

尝试部署我的应用时出现此错误,我需要做的就是:

remove ${deploy_dir}/repo 并成功部署.

在我的情况下,我已经从https://github.com更改为https://bitbucket.org

并且github的所有配置仍然在$ {deploy_dir}/repo中.