如何更改git push的私钥位置

时间:2013-09-17 16:44:47

标签: git heroku

我正在使用heroku。我在git存储库中的本地项目是在闪存驱动器上(F :)我需要将我最初在另一台计算机的c驱动器上设置的ssh私钥的位置更改为f:/ ssh,其中私钥也驻留在。

 $ git push git@heroku.com:MYPROJECT.git master
 The authenticity of host 'heroku.com (x.x.x.x)' can't be established.
 RSA key fingerprint is XXXXXXXXXX.
 Are you sure you want to continue connecting (yes/no)? yes
 Warning: Permanently added 'heroku.com,x.x.x.x' (RSA) to the list of known hosts.
 Permission denied (publickey).
 fatal: Could not read from remote repository.     

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

我该怎么做?

编辑:

按照Shireesh的说明,我在我的F:驱动器中创建了一个带有目录结构的'config'文件:

F:。/ SSH:

id_rsa (private ) 
id_rsa (public ) 
config

config看起来像:

Host heroku.com
User git
IdentityFile /id_rsa

当我重复推动时,我得到了:

Permission denied (publickey).
fatal: Could not read from remote repository.

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

1 个答案:

答案 0 :(得分:2)

将以下行添加到$HOME/.ssh/config

Host heroku.com
   User git
   IdentityFile /path/to/your/ssh/private_key

这应该处理你的ssh密钥的位置。