I want to deploy my rails project by using Capistrano, but it fails when trying cap production deploy:updating
.
This is error message. (I replaced domain and project name.)
[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
And this is my Capistrano setting file 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
I logged in remote server, and cd /var/www/example.com/repo
, and git archive master
, then get same error: fatal: Not a valid object name
.
What should I do solve this problem?
After I manually do git push origin master
, deploy end without error.
It seems first git push
must have done manually.
将您的 deploy.rb 中的分支设置为您的回购中存在的分支...可能是您拥有 main 而不是 master...
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.