Capistrano deploy fails after I changed the repository URL

Jakub Arnold picture Jakub Arnold · Dec 2, 2011 · Viewed 17.1k times · Source

I have a simple deployment via capistrano from a Git repository. At first I was deploying form GitHub, everything worked just fine. But then I moved my repository to BitBucket and now I'm getting

fatal: Could not parse object '9cfb...'.

The problem goes away once I change

set :deploy_via, :remote_cache

to

set :deploy_via, :copy

but that doesn't fix the problem, it only bypasses it. Is there any way I can tell capistrano to just drop the old cache?

Answer

Justin Tanner picture Justin Tanner · Jul 12, 2013

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