Updating a remote server to pull from a renamed Git repo

66 views Asked by At

I have a Git repo which a remote web server is set up to pull from. When I want to update from the active branch I just log-in and run "git pull" and all is good.

I had to rename the repo on Github and updated the reference on my remote webserver using:

git remote set-url origin https://github.com/[organisation]/[repo]

Having done this I ran:

git remote -v

This confirmed that the remote repo name had been updated, however when I run git pull subsequently I get the error:

The requested URL returned error: 403 Forbidden while accessing https://github.com/[organisation]/[repo].git/info/refs

What am I doing wrong? Did I miss a step?

2

There are 2 answers

0
Nathan Pitman On

Ah, got it... I was using instructions pertaining to updating if you were connecting over HTTPS, not SSH. The correct command to run in that instance is:

git remote set-url origin [email protected]:[organisation]/[repo].git

From: https://help.github.com/articles/changing-a-remote-s-url/

0
VonC On

Note: renaming the remote URL using HTTPS can work too, but you need to setup a Git credential helper.

That would allow to use (one time) your username/password (GitHub account credentials), which would then be cached and reused for any subsequent push/pull/clone.