Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: remote origin already exists - GitHub

Tags:

git

github

I'm newly at Git. And I tried to create my first repo and push project.

I'm creating step by step to the Create A Repo.

But after I tried to push my project to the empty repo I caught next:

fatal: remote origin already exists

Here is my steps:

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:nazar-art/NewYearGift.git
git push -u origin master

And exactly here I caught this fatal.

I tried git remote -v to see content of remote repo. Here is result:

origin  https://github.com/nazar-art/NewYearGift.git (fetch)
origin  https://github.com/nazar-art/NewYearGift.git (push)

I couldn't figure out what I'm doing wrong and how to fix this issue?

  • How to solve this trouble?
like image 837
catch23 Avatar asked Dec 13 '13 10:12

catch23


1 Answers

Seems like remote origin is already there somehow and you want to change its uri to another value. You can't add origin since its already there but you can update it. Instead of git remote add command, you can run:

git remote set-url origin [email protected]:nazar-art/NewYearGift.git
like image 122
Faruk Sahin Avatar answered Oct 19 '22 17:10

Faruk Sahin