简体   繁体   中英

capistrano deploy fails - fatal: Needed a single revision

I try to deploy my app to VPS via 'bundle exec cap production deploy', but I get an error

Tasks: TOP => git:create_release => git:update
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing as deploy@178.57.217.128
: cd /var/www/repo && git rev-parse --short HEAD exit status: 128
cd /var/www/repo && git rev-parse --short HEAD stdout: Nothing written
cd /var/www/repo && git rev-parse --short HEAD stderr: fatal: Needed a single revision

My remote git repository contains only one branch - master, and I have no idea what causes this error :(

remote git version is 1.9.1

local git is 1.9.5.msysgit.1

deploy.rb:

# config valid only for Capistrano 3.1
lock '3.1.0'

set :application, 'stroysauna_pg'
set :repo_url, 'git@github.com:IvanSelivanov/stroysauna_pg.git'

namespace :deploy do

  desc 'Restart application'
  task :restart do
    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 :finishing, 'deploy:cleanup'

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      # Here we can do anything such as:
      # within release_path do
      #   execute :rake, 'cache:clear'
      # end
    end
  end

end

.git\\config :

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[gui]
    wmstate = normal
    geometry = 1187x555+90+96 239 251
[branch "lk"]
[branch "master"]
[remote "origin"]
    url = git@github.com:IvanSelivanov/stroysauna_pg.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

created an empty app from scratch - still does not deploy, same error https://github.com/IvanSelivanov/vps

Not exactly a solution, but it works. Rebuilt server from scratch, but used rbenv instead of rvm. Now it deploys without errors.

Rename/delete the repo folder and redeploy using Capistrano. Not sure what causes this issue, but this fixed it easily for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM