2017-11-10 175 views
1

我在Mac上並試圖克隆在另一臺機器上創建的回報,並使用私人github帳戶創建。儘管驗證成功,但無法克隆回購

我經歷了典型的SSH密鑰步驟,但出於某種原因,我仍然無法使用SSH進行克隆。

當我運行:

ssh -T [email protected]<private account> 

我得到

Hi <private account>! You've successfully authenticated, but GitHub does not provide shell access. 

我的〜/ .ssh/config中

Host github.com 
HostName github.com 
User git 
IdentityFile ~/.ssh/id_rsa 
IdentitiesOnly yes 

Host github.com-<private account> 
HostName github.com 
User git 
IdentityFile ~/.ssh/id_rsa_**** 
IdentitiesOnly yes 

當我克隆:

Cloning into 'my repo'... 
ERROR: Repository not found. 
fatal: Could not read from remote repository. 

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

我不會得到任何不尋常的:

ssh -v [email protected]<private account> 

回購與git的1.9.1創建的,而我試圖用2.11.0克隆。這可能會有所作爲嗎?

+1

您正在使用什麼命令克隆? –

+0

git clone [email protected]:/ .git,這是github上的克隆或下載按鈕提供的url –

回答

1

Git版本的區別應該不重要。

但是如果你想用正確的SSH認證克隆,你需要使用正確的SSH網址:

git clone github.com-<private account>:<auser>/<aproject.git> 
+0

<私人帳戶>和有什麼區別? –

+0

@ C-RAD我只是想使用你的〜/ .ssh/config文件中的確切字符串作爲'Host'。這標識了服務器。之後,回購路徑通常是用戶帳戶/回購 – VonC

+0

我在配置文件中創建了該塊,以便使用與我的私人帳戶不同的密鑰。我相信主機應該被定義爲github.com- 嗎?點擊後,github上的「克隆或下載」按鈕將顯示[email protected]:/ .git作爲用於使用ssh克隆的url。 –