Github “fatal: remote origin already exists”

2019-01-03 04:05发布

I am trying to follow along Michael Hartl's Rails tutorial but I've run across an error.

I signed up on Github and issued a new SSH key and made a new repository. But when I enter the next line into the terminal I get the following error:

Parkers-MacBook-Pro:.ssh ppreyer$ git remote add origin git@github.com:ppreyer/first_app.git
fatal: remote origin already exists.

Just wondered if anybody else has run across this problem?

15条回答
何必那么认真
2楼-- · 2019-01-03 04:30

First check To see how many aliases you have and what are they, you can initiate this command git remote -v

Then see in which repository you are in then try git remote set-url --add [Then your repositpory link] git push -u origin master

查看更多
别忘想泡老子
3楼-- · 2019-01-03 04:31

if you already add project for another storage, like you upload to github and then you upload to bitbucket then it shows this type of Error.

How to remove Error: delete git-hub file in your project and then repeat the following steps...

git init       
git remote add origin git@bitbucket.org:Yourname/firstdemotry.git  
git add -A  
git commit -m 'Message'  
git push -u origin master  
查看更多
等我变得足够好
4楼-- · 2019-01-03 04:32

In Short,

git remote rm origin
git remote add origin git@github.com:username/myapp.git

Worked !

Cheers!

查看更多
登录 后发表回答