2017-05-17 105 views
2

我遇到了一個奇怪的問題,同時使用SSH克隆git倉庫。我有SSH設置:Github SSH工作,但使用SSH克隆失敗

ssh -T [email protected] 
Hi yusufali2205! You've successfully authenticated, but GitHub does not provide shell access. 

我使用正確的克隆網址,並有機會獲得我想克隆回購。但得到錯誤:

➤ git clone [email protected]:<some-org>/<repo>.git 
Cloning into 'project'... 
Permission denied (publickey). 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists. 

沒有其他消息來調試我的SSH設置或git配置有什麼問題。

回答

3

我發現在我的.gitconfig中有一個條目用https代替ssh。

[url "https"] 
    insteadOf = git 

我可能在使用某種工具時意外添加了這個條目。所以克隆命令實際上是使用url [email protected]:<some-org>/<repo>.git

.gitconfig刪除上述條目後,問題已解決。