Github “fatal: remote origin already exists”錯誤

新建一個Gitlab project,準備將本地Git項目上傳到Gitlab時,報本地項目之前已經綁定到了另外一個項目,想起來當時是在Gitlab中clone別人的項目到本地,因此需要重新設置綁定,將項目綁定到新建的project上,從網上看到解決方案於是羅列在下面:

TL;DR you should just update the existing remote:
$ git remote set-url origin [email protected]:ppreyer/first_app.git

Long version:

As the error message indicates, there is already a remote configured with the same name. So you can either add the new remote with a different name or update the existing one if you don't need it:
To add a new remote, called for example github instead of origin (which obviously already exists in your system), do the following:
$ git remote add github [email protected]:ppreyer/first_app.git
Remember though, everywhere in the tutorial you see "origin" you should replace it with "github". For example $ git push origin master should now be $ git push github master.
However, if you want to see what that origin which already exists is, you can do a $ git remote -v. If you think this is there by some error, you can update it like so:
$ git remote set-url origin [email protected]:ppreyer/first_app.git


地址:https://stackoverflow.com/questions/10904339/github-fatal-remote-origin-already-exists

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章