tags:

views:

84

answers:

2

I have a repo (origin) on an USB key that I cloned on my hardrive (local). I moved "origin" to a NAS and I successfully tested cloning it from here.

I would like to know if I can change the uri of "origin" in the settings of "local" so it now pull from the NAS, and not from the USB key.

For now, I can see two solutions : - pushing everything to the usb-orign, and copy it to the NAS again (implies a lot of work due to new commits to nas-origin); - adding a new remote to "local" and delete the old one (i fear I'll break my historic).

+1  A: 

There are these solutions:

  1. Edit the path in .git/remotes
  2. Use git push "path to your repo on the NAS" all the time
  3. Commit all changes from your local copy to the NAS, delete the local copy and clone it again from the NAS.
Aaron Digulla
+3  A: 

You can

git remote set-url origin git://new.url.here

(see git help remote) or you can just edit .git/config and change the URLs there. You're not in any danger of losing history unless you do something very silly (and if you're worried, just make a copy of your repo, since your repo is your history.)

hobbs