-3

I'd like to overwrite the origin of my git repo (I moved it from my company account to personal account).

When I do git remote add origin it complains that the origin already exists

Toli
  • 5,547
  • 8
  • 36
  • 56
  • 2
    Does this answer your question? [How to change the URI (URL) for a remote Git repository?](https://stackoverflow.com/questions/2432764/how-to-change-the-uri-url-for-a-remote-git-repository) – evolutionxbox Aug 09 '20 at 21:34
  • 1
    When the error message already exists *down to the branch* we don't need another Q&A pair. – jonrsharpe Aug 09 '20 at 21:38

3 Answers3

0

You change the location of your remote origin with git remote set-url origin <new-url-here>

More info can be found in the docs here: https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emset-urlem

dumazy
  • 13,857
  • 12
  • 66
  • 113
0

You can either change the target URL by doing

git remote set-url origin <new-url>
Pankaj Saini
  • 1,493
  • 8
  • 13
-1
git remote rm origin
git remote add origin ORIGIN
git config master.remote origin
git config master.merge refs/heads/master

Replace ORIGIN with your origin

Example

git remote rm origin
git remote add origin git@github.com:tolicodes/infragen.git
git config master.remote origin
git config master.merge refs/heads/master
Toli
  • 5,547
  • 8
  • 36
  • 56