2017-11-10 187 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。 –