Git 提示 fatal: remote origin already exists(遠端來源已經存在)問題解決辦法
阿新 • • 發佈:2022-03-04
如果當前目錄下已經有遠端倉庫,就會報如下的錯:
fatal: remote origin already exists.
此時,我們可以先 git remote -v 檢視遠端庫資訊:
# git remote -v
origin https://gitee.com/varden99/ansible-playbooks.git (fetch)
origin https://gitee.com/varden99/ansible-playbooks.git (push)
可以看到,本地庫已經關聯了origin的遠端庫,並且該遠端庫指向Gitee。
解決辦法如下:
作者:Varden 出處:http://www.cnblogs.com/varden/ 本文內容如有雷同,請聯絡作者! 本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段宣告,且在文章頁面明顯位置給出原文連線,否則保留追究法律責任的權利。# git remote remove origin # git remote add origin https://gitee.com/varden99/ansible-playbooks.git # git remote -v origin https://gitee.com/varden99/ansible-playbooks.git (fetch) origin https://gitee.com/varden99/ansible-playbooks.git (push) # git branch * main # git push --set-upstream origin main