Capistrano deploy fails after I changed the repository URL

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.


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

  1. Remove the $deploy_to/repo directory
  2. Modify your config/deploy.rb (same as 2.X)
  3. cap deploy