如何添加heroku密钥让git正常工作 [英] How to add heroku key to git to work properly
问题描述
我正在使用windows7。我使用
heroku创建了loka-xxxx
$ p创建了heroku APP $ p>
它会为我使用git链接创建一个应用程序。
git @ heroku.com:loka-xxxx.git
但是当我这样做时。
git push heroku master
它给了我这个错误
Permission denied(publickey)。
在heroku之前,我的窗口机器上安装了github。
所以,这是关键错误。为此,当我做的时候heroku键
这给我一个关键。
我想知道如何将此heroku密钥添加到git以及如何告诉git使用不同的密钥(默认& heroku)。
解决方案下面是我遵循的步骤使heroku与git一起工作在我的Windows机器上。
第1步:创建使用的ssh rsa密钥。
1.1在windows上创建ssh密钥,你需要一些额外的工具 from this。
第二步:使用 putty key-gen 生成ssh密钥。将此密钥命名为id_rsa。现在,您必须配对id_rsa键(pub& ppk)。
第3步:
将这些键放入您的c:\用户名\<用户名> \.ssh
文件夹。
第4步。
现在转到安装git的文件夹。像C:\程序文件(x86)\Git
并尝试创建.ssh文件夹。注意:要创建.ssh文件夹,您需要以管理员身份运行cmd并运行mkdir .ssh。
第5步。
现在将您的id_rsa密钥对文件夹C:\程序文件(x86)\Git\.ssh
第6步。
再次打开您的cmd。
转到您的应用程序文件夹并重新初始化git。这里是命令序列。git init
git add。
git commit -m现在将解决
heroku键:清除
heroku键:添加
git remote add heroku git@heroku.com:< ;您的应用程序> .git
现在您可以执行
git push heroku master
。希望我已经涵盖了Windows用户的所有步骤。 for mac和unix用户关注。
温菲尔德I am using windows7. I have created heroku APP using
heroku create loka-xxxx
It will create an app for me with git link.
git@heroku.com:loka-xxxx.git
but when i do.
git push heroku master
It gives me this error "Permission denied (publickey)".
Before heroku i had github installed on my window machine. So, this is key error. For this when i do
heroku keys
this show me a key.
I want to know how add this heroku key to git and how to tell git to use different keys to use at different operations(default & heroku).
解决方案Here is the steps i followed to make heroku work with git on my windows machine. Step 1: create ssh rsa keys to use. 1.1 On windows to create ssh keys you need some additional tools from here.
Step 2: Generate ssh key using putty key-gen. name this key as id_rsa. Now you have to pair of id_rsa key(pub&ppk).
Step 3: Put these keys into your
c:\users\<user-name>\.ssh
folder.
Step 4. Now go to the folder where your git is installed. like
C:\Program Files (x86)\Git
and try to create .ssh folder. Note: to create .ssh folder you need to run cmd as administrator and run mkdir .ssh.
Step 5. Now put your id_rsa key pair in this folder "C:\Program Files (x86)\Git\.ssh"
Step 6. open your cmd again. Goto your app folder and do initialize git again. here is the sequence of commands.
git init git add . git commit -m "This will be resolved now" heroku keys:clear heroku keys:add git remote add heroku git@heroku.com:<your app>.git
Now you can do
git push heroku master
. Hope i have covered all the steps for the windows user. for mac and unix user follow. Winfield这篇关于如何添加heroku密钥让git正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!