2014-01-05 46 views
0

我想通过Capistrano部署我的rails项目,但尝试cap production deploy:updating时失败。尝试`git archive master`时Capistrano部署失败

这是错误信息。 (我更换域名和项目名称。)

[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message. 
INFO [f71ac456] Running /usr/bin/env mkdir -p /tmp/exmaple/ on example.com 
DEBUG [f71ac456] Command: /usr/bin/env mkdir -p /tmp/exmaple/ 
INFO [f71ac456] Finished in 0.736 seconds with exit status 0 (successful). 
DEBUG Uploading /tmp/exmaple/git-ssh.sh 0.0% 
INFO Uploading /tmp/exmaple/git-ssh.sh 100.0% 
INFO [c1918686] Running /usr/bin/env chmod +x /tmp/exmaple/git-ssh.sh on example.com 
DEBUG [c1918686] Command: /usr/bin/env chmod +x /tmp/exmaple/git-ssh.sh 
INFO [c1918686] Finished in 0.062 seconds with exit status 0 (successful). 
DEBUG [905ddc4a] Running /usr/bin/env [ -f /var/www/example.com/repo/HEAD ] on example.com 
DEBUG [905ddc4a] Command: [ -f /var/www/example.com/repo/HEAD ] 
DEBUG [905ddc4a] Finished in 0.053 seconds with exit status 0 (successful). 
INFO The repository mirror is at /var/www/example.com/repo 
DEBUG [e9c1eeda] Running /usr/bin/env if test ! -d /var/www/example.com/repo; then echo "Directory does not exist '/var/www/example.com/repo'" 1>&2; false; fi on example.com 
DEBUG [e9c1eeda] Command: if test ! -d /var/www/example.com/repo; then echo "Directory does not exist '/var/www/example.com/repo'" 1>&2; false; fi 
DEBUG [e9c1eeda] Finished in 0.053 seconds with exit status 0 (successful). 
INFO [9bd77dfe] Running /usr/bin/env git remote update on example.com 
DEBUG [9bd77dfe] Command: cd /var/www/example.com/repo && /usr/bin/env git remote update 
DEBUG [9bd77dfe] Fetching origin 
INFO [9bd77dfe] Finished in 0.068 seconds with exit status 0 (successful). 
DEBUG [4fe5034f] Running /usr/bin/env if test ! -d /var/www/example.com/repo; then echo "Directory does not exist '/var/www/example.com/repo'" 1>&2; false; fi on example.com 
DEBUG [4fe5034f] Command: if test ! -d /var/www/example.com/repo; then echo "Directory does not exist '/var/www/example.com/repo'" 1>&2; false; fi 
DEBUG [4fe5034f] Finished in 0.059 seconds with exit status 0 (successful). 
INFO [d75938a4] Running /usr/bin/env mkdir -p /var/www/example.com/releases/20140105125534 on example.com 
DEBUG [d75938a4] Command: cd /var/www/example.com/repo && (GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/exmaple/git-ssh.sh /usr/bin/env mkdir -p /var/www/example.com/releases/20140105125534) 
INFO [d75938a4] Finished in 0.057 seconds with exit status 0 (successful). 
INFO [9f7ea103] Running /usr/bin/env git archive master | tar -x -C /var/www/example.com/releases/20140105125534 on example.com 
DEBUG [9f7ea103] Command: cd /var/www/example.com/repo && (GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/exmaple/git-ssh.sh /usr/bin/env git archive master | tar -x -C /var/www/example.com/releases/20140105125534) 
DEBUG [9f7ea103] fatal: Not a valid object name 

这是我Capistrano的设置文件production.rb

set :application, 'example' 
set :repo_url, '~/git-repos/example.com.git' 

set :deploy_to, '/var/www/example.com' 
set :scm, :git 
set :branch, 'master' 

set :keep_releases, 5 

namespace :deploy do 

    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
    end 
    end 

    after :restart, :clear_cache do 
    on roles(:web), in: :groups, limit: 3, wait: 10 do 
    end 
    end 

    after :finishing, 'deploy:cleanup' 
end 

我在远程服务器上登录,并cd /var/www/example.com/repogit archive master,然后得到同样的错误:fatal: Not a valid object name

我该怎么解决这个问题?

回答

0

当我手动执行git push origin master后,部署结束时没有错误。

看来第一个git push必须手动完成。