Capistrano error when change repository using git

Capistrano < 3

Fix it in ./shared/cached-copy/.git/config from deployment folder of your server.

OR ugly way do this:

Remove the shared/cached-copy from deployment folder of your server.

Capistrano > 3

Fix it in ./repo/config from deployment folder of your server.

Learn How to fix similar issues

It is caused as your server files are referring to old repo so you have to find and fix it. Do this to find matches in files:

cd /path/to/your/project
grep -r OLD_REPO_NAME ./

Now you see all files including your OLD_REPO_NAME . If they are matched in your release folder or current, you dont need to care for fixing them. But you should fix all configs.


With capistrano 3, to avoid deleting the repo folder :

  1. Change the repo URL in your config/deploy.rb, as the OP already did

  2. SSH to your server inside and change the remote URL of the git repo :

    ssh [email protected]  
    # Go the capistrano deploy root
    cd /capistrano/deploy/root/folder  
    # Go inside the folder names *repo*
    cd repo  
    # Manually change the git remote
    git remote set-url origin ...