How to fix capistrano deployment? git exit status: 1

I am using Capistrano 3.2.1 with Rails 4.0 in my application. I am trying to install gem from my github repo. But that does not work. I have no idea what is going on. When I run ssh -T git@github.comon my server, it becomes successful. But when I run cap production deploy, I get the following errors:

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
>

Here 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'

From server:

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

The most unpleasant part of this process is that this process runs on my colleague's computer.

Any idea? If you need more information, let me know.

+4
source share
2 answers

, , :

remove ${deploy_dir}/repo .

https://github.com https://bitbucket.org

github ${deploy_dir}/repo.

+4

, . , :

ls -l ~/.ssh

, (600), .

:

set :repository, "git@github.com:name/project.git"

: repo_url. ( , 2. 3 , : repo_url.)

0

Source: https://habr.com/ru/post/1542379/


All Articles