FIX: Capistrano deploy fails after changing repository URL

We have moved some of our clients repositories from Github to Bitbucket but when we tried to deploy we got the following error:

fatal: Could not parse object '.....'.
failed: "sh -c 'if [ -d /var/www/shared/cached-copy ] .....

I tried making a clean-up but that didn’t work.

The solution however is pretty straight forward. You just need to login to the server and then remove the cached-copy folder. For the sake of it, start out by just changing name, and if it works to deploy remove it :)

On the server:

mv /var/www/shared/cached-copy /var/www/shared/cached-copy-backup/

Run deploy from dev machine and if it works you just delete the folder from the server

rm -Rf /var/www/shared/cached-copy-backup

Good stuff! Cheers.