Capistrano deploy fails after I changed the repository URL
Solution 1:
Capistrano 2.X
Delete and re-clone the repo using the new address:
cd $deploy_to/shared
rm -rf cached-copy
git clone ssh://[email protected]/new/repo.git cached-copy
Modify your config/deploy.rb
to use the new repo:
set :repository, "ssh://[email protected]/new/repo.git"
set :scm, :git
set :deploy_via, :remote_cache
Deploy again:
cap deploy
Capistrano 3.X
- Remove the
$deploy_to/repo
directory - Modify your
config/deploy.rb
(same as 2.X) cap deploy
Solution 2:
I gotta say I’m not sure, since I haven’t been able to test this but this should work:
cap deploy:cleanup -s keep_releases=0
Since it wipes every release (cache) from the server.
Apparently you will also need to remove shared/cached-copy
, because this doesn’t seem to be cleaned by the Capistrano call above according to the comment below.
Solution 3:
Capistrano 2 and below
SSH to your server and update the repo in ./shared/cached-copy/.git/config
of the deployment folder, or just remove the ./shared/cached-copy
Capistrano 3 and above
SSH to your server and update the repo in ./repo/config
of the deployment folder.
Check Fixing Capistrano 3 deployments after a repository change