2014-01-15 58 views
2

我试图从github项目拉到我的本地存储库。无法从github提取更改 - 权限被拒绝(publickey)。致命:无法从远程存储库读取

我生成了所有必需的ssh密钥。我克隆了这个项目。但是当我试图把我的变化抓到:

$ git pull 
The authenticity of host 'github.com (192.30.252.129)' can't be established. 
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. 
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of know 
n hosts. 
Permission denied (publickey). 
fatal: Could not read from remote repository. 

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

这里是.ssh内容:

的C目录:\用户\ nlel.ssh

15.01.2014 13:35 <DIR>   . 
15.01.2014 13:35 <DIR>   .. 
09.01.2014 15:24    1 675 github_rsa 
09.01.2014 15:24    391 github_rsa.pub 
09.01.2014 13:08    1 751 id_rsa 
09.01.2014 13:08    405 id_rsa.pub 
15.01.2014 13:36    803 known_hosts 
       5 File(s)   5 025 bytes 
       2 Dir(s) 59 142 991 872 bytes free 

它们在github上呈现帐户。我克隆了项目好。

解决方案:

我重新创建我的钥匙。并使用关键短语再次生成它们。
我从pc和github删除旧密钥,并添加新的。

现在所有的作品。棘手的一点是,这个回购是私人的。

- 为什么会发生这种情况?
- 如何解决这个麻烦?

+0

您用来克隆的命令是什么,克隆后您是否对密钥做任何更改? – Bijendra

+0

好吧,我已经在答案中包含了你的结论以获得更多的知名度。 – VonC

回答

3

SSH只能寻求%HOME%\.ssh\id_rsa(.pub)

如果你想ssh来挑选不同一套钥匙,你需要声明那些在%HOME\.ssh\config文件(我不你的目录看到)。

config文件将包括类似:

Host github 
    HostName github.com 
    User git 
    IdentityFile C:\path\to\.ssh\github_rsa 
    IdentitiesOnly yes 

与远程重命名你的 'origin' 的网址:

cd /path/to/my/repo 
git remote set-url origin github:yourName/YourRepo.git 

这是需要推动(写)一个GitHub库你拥有。
你不需要SSH密钥从公开回购。


OP nazar-art的情况下,密钥不是可能是正确的,并重新创建这些已经足够:

我重新创建我的钥匙。并使用关键短语再次生成它们。
我从pc和github删除旧密钥,并添加新的。

+0

它是否必须是'config.txt'文件?用户我想必须是我? –

+0

@nazar_art不只是'config'。例如,请参阅http://stackoverflow.com/a/20596571/6309。 – VonC

相关问题