Back

Explore Courses Blog Tutorials Interview Questions
+6 votes
2 views
in DevOps and Agile by (19.4k points)
edited by

I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved "origin" to a NAS and 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 will now pull from the NAS, and not from the USB key.

For now, I can see two solutions:

  • push everything to the usb-orign, and copy it to the NAS again (implies a lot of work due to new commits to nas-origin);

  • add a new remote to "local" and delete the old one (I fear I'll break my history).

1 Answer

+6 votes
by (27.5k points)
edited by

Option A:
Use the following command to do the same:

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

Option B:
Edit .git/config and change the URLs there.

For more details go through this tutorial link of git that helps:

Browse Categories

...