2016-04-23 103 views
0

我有一個公鑰與GitHub。今天就做到了。我關閉了Git並將其重新啓動,現在它不會推動我的項目。它會生成以下錯誤:Git推送命令

權限被拒絕(publickey)。 致命:無法從遠程存儲庫讀取。

請確保您擁有正確的訪問權限 並存在存儲庫。

,當我嘗試執行以下命令得好: git的遠程添加原產 我得到以下信息: 致命:遠程起源已經存在。

有人可以請幫忙。我花了很多時間嘗試在這裏使用建議的解決方案,但沒有一個爲我工作。最後,我是否需要將Git初始化到我的公共密鑰目錄,並確保每次啓動Git時都可以訪問GitHub?

+0

你能告訴我們你已經試過了什麼,所以我們不建議重複的解決方案? – pushasha

+0

http://stackoverflow.com/questions/10904339/github-fatal-remote-origin-already-exists –

+0

http://stackoverflow.com/questions/19660744/git-push-permission-denied-public-key –

回答

1

錯誤 '致命:遠程起源已經存在' 意味着你已經做了

git remote add origin 'your git repo' 

要刪除的來源,這樣做:

git remote rm origin 

和重做命令:

git remote add origin 'your git repo' 

例如:

git remote add origin https://github.com/YourUsername/YourProject.git 

還要確保存儲庫存在並且在GitHub上創建,並且您有權訪問它。

+0

非常感謝。有效。我刪除了原點,並重新命令,但不是使用[email protected]:/UserName/Project.git,我使用了你給我的東西:https://github.com/YourUsername/YourProject.git –

+0

代替YourUsername和YourProject,你把你的github用戶名和你的github項目。 一個例子可以成爲我: 'git的遠程添加原產https://開頭github.com/Li357/SudokuSolver.py' 如果我你能捨得,給我一個大拇指和所選擇的答案:) – Li357

+0

我的意思是gitHub提供了以下命令:git remote add origin [email protected]:UserName/Project.git。相反,我用:git remote add origin https://github.com/UserName/Project.git。而不是[email protected]我用你給我的東西https://github.com –