Reputation: 9800
I'm have two git accounts. When I am trying to register a second remote
git remote add origin [email protected]:RiyaKapuria/testing.git
git push -u origin master
During pushing to my repo I'm getting this error:
fatal: remote origin already exists
Upvotes: 7
Views: 14440
Reputation: 1
**We have two option:-
1.Replace existing origin: (i)Check default origin:
git remote -v
(ii)Remove default origin:
git remote remove origin
or
git remote rm origin
(iii) Now add your git URL:
git remote add origin your_git_url
(i) add first origin: - git remote set-url --add --push origin git://original/repo.git
(ii) Now add second origin:- git remote set-url --add --push origin git://another/repo.git same you can add more origin
Or you can solve error by help of link: https://www.youtube.com/watch?v=dnU4CPhuQRo
Upvotes: -1
Reputation: 1078
replace origin by another name. because origin already exists. Like
git remote add upstream [email protected]:RiyaKapuria/testing.git
Upvotes: 10
Reputation: 312219
You already have a remote named origin
(the one you cloned from). Just give the new remote a different name and you should be OK:
$ git remote add another_origin [email protected]:RiyaKapuria/testing.git
and then push to the another_origin
by executing
git push -u another_origin master
Upvotes: 6