Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle Git error "remote origin already exists"?

Tags:

git

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

like image 639
Riya Kapuria Avatar asked Dec 08 '22 16:12

Riya Kapuria


2 Answers

replace origin by another name. because origin already exists. Like

git remote add upstream [email protected]:RiyaKapuria/testing.git
like image 158
Pratheesh M Avatar answered Dec 11 '22 09:12

Pratheesh M


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
like image 27
Mureinik Avatar answered Dec 11 '22 08:12

Mureinik