How to add hero key to git for proper operation

I am using windows7. I created a heroku APP using

heroku create loka-xxxx 

He will create an application for me with a git link.

 git@heroku.com :loka-xxxx.git 

but when I do it.

 git push heroku master 

This gives me this error "Permission denied (publickey)".

Before the hero, I had github installed on my window computer. So this is a key mistake. For this, when I do

 heroku keys 

it will show me the key.

I want to know how to add this hero key to git and how to tell git to use different keys for use in different operations (by default and to the hero).

+6
source share
2 answers

Here are the steps I took to make the hero work with git on my Windows machine. Step 1: create ssh rsa keys to use. 1.1. In windows for creating ssh keys you need additional tools from here.

Step 2: generate the ssh key using putty key-gen . name this key as id_rsa. Now you need to set the id_rsa pair (pub & ppk).

Step 3: Put these keys in your

 c:\users\<user-name>\.ssh 

folder.

Step 4. Now go to the folder where your git is installed. as

 C:\Program Files (x86)\Git 

and try to create the .ssh folder. Note: to create the .ssh folder, you must run cmd as an 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. Reopen your cmd. Go to the application folder and 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 reviewed all the steps for a Windows user. for mac and unix user. Winfield

+6
source

If you only have git keys, you can add your public SSH key to Heroku to allow pushing with any key already configured on the local git install:

 > heroku keys:add 

... and then select id_rsa.pub or any other key that you already use.

This will allow you to click on github using an existing key.

If you have a private key for the public key on your Heroku account (specified via heroku keys ), you can rewrite the default private key in $HOME/.ssh/id_rsa using the Heroku private key.

+1
source

All Articles