6

I am using windows7. I have created heroku APP using

heroku create loka-xxxx

It will create an app for me with git link.

[email protected]: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).

asked Feb 14, 2014 at 20:53
1

2 Answers 2

6

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 [email protected]:<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

answered Feb 20, 2014 at 9:29
Sign up to request clarification or add additional context in comments.

Comments

1

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

> heroku keys:add

... and then select id_rsa.pub or whichever key you are using already.

This will allow you to push to github using your existing key.

If you have the private key for the public key already on your Heroku account (listed via heroku keys), you can over-write the default private key in $HOME/.ssh/id_rsa with your Heroku private key.

answered Feb 17, 2014 at 16:17

4 Comments

should be $ heroku keys:add ?
@Winfield i want to add heroku key to git. As i don't have id_rsa key with me. As you don't have the privilege to do ssh-keygen on windows cmd.
Added instructions for how to over-write default SSH private key
Thanks for your answer. I assume you don't use windows as for windows it was bit different.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.