git退出状态:2与capistrano

时间:2014-06-11 23:50:22

标签: ruby-on-rails git ruby-on-rails-4 capistrano

有一段时间我和Capistrano有了status: 1,现在让它运转了。我部署了,事情进展顺利,但后来陷入了困境。

这是我的deploy.rb文件:

# config valid only for Capistrano 3.1
lock '3.2.1'



set :application, 'Joggleio'
set :repo_url, 'git@github.com: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

不确定那是怎么回事

就在此之前我得到了这个:

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

非常感谢任何帮助!!

1 个答案:

答案 0 :(得分:6)

我遇到了同样的问题。根本原因是您指定的分支尚未在远程git repo上。我正在使用git flow,所以我将我的分支指定为develop。将此分支推送到远程并再次部署之后问题就消失了。