Mohamed El Mahallawy
Mohamed El Mahallawy

Reputation: 13842

git exit status: 2 with capistrano

For a while I had the status: 1 with Capistrano and now got it working. I deployed and things were going well but then it got stuck at this below.

Here is my deploy.rb file:

# config valid only for Capistrano 3.1
lock '3.2.1'



set :application, 'Joggleio'
set :repo_url, '[email protected]:xxxxxx/xxxxxx.io.git'
# set :repo_url, 'git://github.com:xxxxxxxx/xxxxxxx.io.git'


# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call

# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/home/tristan/xxxxxxx'

# Default value for :scm is :git
set :scm, :git
set :branch, "production"

# Default value for :format is :pretty
set :format, :pretty

# Default value for :log_level is :debug
# set :log_level, :debug

# Default value for :pty is false
set :pty, true

# Default value for :linked_files is []
# set :linked_files, %w{config/database.yml}

# Default value for linked_dirs is []
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
set :keep_releases, 5

# User
set :user, "tristan"

set :use_sudo, false

# Rails env
set :rails_env, "production"

set :deploy_via, :remote_cache

set :ssh_options, { :forward_agent => true}
set :default_stage, "production"

# server "xx.xxx.xxx.xx", :app, :web, :db, :primary => true

namespace :deploy do

  # before "deploy", "deploy:stop_dj"


  desc 'Restart application'
  task :restart do

    sudo "service nginx restart"
    run "RAILS_ENV=production rake assets:precompile"
    run "RAILS_ENV=production bin/delayed_job -n2 restart"
    # on roles(:app), in: :sequence, wait: 5 do
    #   # Your restart mechanism here, for example:
    #   # execute :touch, release_path.join('tmp/restart.txt')
    # end
  end

  after :publishing, :restart

  after :restart, "deploy:cleanup"

end

Not sure what is going on that's wrong

Just before that I get this:

Command: cd /home/tristan/xxxx/repo && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/xxxxx/git-ssh.sh /usr/bin/env git archive production | tar -x -C /home/tristan/xxxxx/releases/20140611234421 )
DEBUG[0dbe45c7]     fatal: Not a valid object name
DEBUG[0dbe45c7]     tar: This does not look like a tar archive
DEBUG[0dbe45c7]     tar: Exiting with failure status due to previous errors

Any help is greatly appreciated!!

Upvotes: 1

Views: 1321

Answers (1)

Tyrael Tong
Tyrael Tong

Reputation: 761

I just run into same problem. The root cause is the branch you specified is not on the remote git repo yet. I'm using git flow so I specify my branch as develop. after push this branch to remote and deploy again the problem is gone.

Upvotes: 6

Related Questions