今天把github中的一個倉庫刪除,準備通過AndroidStudio重新上傳該項目,但是在上傳的過程中出現了“fatal: remote github already exists”錯誤,谷歌許久終於找到解決方法。
解決方法:
關閉Android Studio,進入電腦中你要上傳的那個項目的目錄,開啓“顯示隱藏文件”的功能,就能看到隱藏的文件夾/.git ,打開其中的config文件,刪除類似於下面格式的三行:
[remote "origin"] url = https://github.com/haoge728/CloudMusic.git fetch = +refs/heads/*:refs/remotes/origin/*
然後保存config文件。重新打開Android Studio,點擊“Share project on GitHub”上傳項目到github,就不會有“ project is already on GitHub ”或者“fatal: remote github already exists”的錯誤提示了。