【问题标题】:git exit status: 2 with capistranogit exit status: 2 with capistrano
【发布时间】:2014-06-11 23:50:22
【问题描述】:

有一段时间,我在 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

非常感谢任何帮助!

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 谢谢。就我而言,我忘记了像'feature/'这样的前缀
    猜你喜欢
    • 2015-11-09
    • 1970-01-01
    • 2020-10-13
    • 2019-03-19
    • 2020-10-04
    • 2011-08-20
    • 2021-11-07
    • 2022-06-11
    • 2018-10-13
    相关资源
    最近更新 更多