LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   GIT: My remote repository moved. How do I tell my local repo to use the new one? (https://www.linuxquestions.org/questions/programming-9/git-my-remote-repository-moved-how-do-i-tell-my-local-repo-to-use-the-new-one-781785/)

BrianK 01-12-2010 03:12 PM

GIT: My remote repository moved. How do I tell my local repo to use the new one?
 
I have a local git repository that pushes to a remote repository. That remote repository moved to a new server. How do I make "git push" and "git pull" push/pull to/from the new repo?

It's probably very simple, but I don't want to screw anything up, so I'm asking first. ;)

indienick 01-12-2010 03:55 PM

It's as simple as deleting the existing remote, and adding a new one. To view (and then delete the existing remote), do the following:
Code:

First, let's find out what your remote's name was:
$ git remote
origin

Now, let's find out a bit more information about your remote:
$ git remote show origin
* remote origin
...
... yadda yadda yadda
...

Neato, now let's get rid of it.
$ git remote rm origin

To add a new remote:
Code:

$ git remote add origin path_to_new_remote
:)

BrianK 01-20-2010 09:35 PM

Thanks for that info! I knew there must be a 'proper' way to do it.

I just went in & edited the .git/remotes/origin file. That works too. ;)

indienick 01-20-2010 11:30 PM

Anytime. :)


All times are GMT -5. The time now is 12:07 AM.