pragmatic_programmer pragmatic_programmer - 11 months ago 67
Git Question

Capistrano deploy fails for repo that was moved from github to private git.. stil trying to contact github.. why?

I have a Rails 4 project that started at github and then it was moved to a private git repository. I can work perfectly with the repo (push, clone). I searched for references to the github repo somewhere in the code but none exists.. it must be something related to GIT and how the repository started..

Important: I was able to deploy with this configuration from my private repo until I removed the github one.

Of course I have updated config/deploy.rb

set :repo_url, '/srv/git/project.git'

Running "git remote -v":

origin git@git.server:/srv/git/project.git (fetch)
origin git@git.server:/srv/git/project.git (push)

Log of capistrano run "bundle exec cap production deploy":

00:00 git:wrapper
01 mkdir -p /tmp
server's password:
✔ 01 server 6.019s
00:07 git:check
01 git ls-remote --heads /srv/git/project.git
01 6b0c9f5ad2d8e768902c5da1509fd99915068295 refs/heads/master
✔ 01 server 0.356s
00:07 deploy:check:directories
01 mkdir -p /home/user/applications/project/shared /home/user/applications/project/releases
✔ 01 user@server 0.335s
00:08 deploy:check:linked_dirs
01 mkdir -p /home/user/applications/project/shared/public/assets
✔ 01 user@server 0.331s
00:09 git:clone
The repository mirror is at /home/user/applications/project/repo
00:10 git:update
01 git remote update --prune
01 Fetching origin
01 remote: Invalid username or password.
01 fatal: Authentication failed for ''
01 error: Could not fetch origin

Moved from SVN to GIT not so much ago and a bit confused about this behaviour.. any help apreciated!

Answer Source

You have to change the origin on the server. The easiest way to accomplish this would probably be to SSH into the server, navigate to /home/user/applications/project/repo and:

git remote set-url origin /srv/git/project.git

I don't believe that capistrano will automatically update the remote.