20

I am trying to clone a git repo that I forked in my GitHub Repository.It's a rails app. I want to clone it on my local git so that I can push it onto heroku. I generated a set of rsa keys and copied it onto my GitHUb public keys. When I try to git clone "public url" , It says public key denied. I tried an ssh git@github.com to verify my key, it also says public key denied. I've tried several different things to make it work but it still hasn't. I tried to change permissions to 600 and 700 on my .ssh folder. I also tried adding a dsa key because the rsa won't work. please help me. Thanks. :)

I'm on Vista btw.

KT.
  • 571
  • 3
  • 6
  • 19

8 Answers8

29

Answering a very old thread, here, but I'm on Cygwin and just had to do this to start work with my newly created site on phpfog.com

First, I ran this in cygwin:

exec ssh-agent bash
ssh-add ~/.ssh/private-key-name

I then received:

Identity added: /home/scott/.ssh/private-key-name (/home/scott/.ssh/private-key-name)
Scott
  • 1,862
  • 1
  • 33
  • 53
  • 4
    This fixed some very annoying `git clone` issues for me. Why must SSH/SSL identity management be so perpetually obtuse? – aroth Apr 13 '12 at 01:56
  • 1
    For me it adds identity only for the started bash window (I am on Cygwin) but after I close it command-line commands continue rejecting the public key. Any chance to make this change permanent? – kirhgoff Mar 22 '13 at 07:09
  • This fixed my `git push origin master` issue with Springloops. Amazing, thank you! – montrealist Jan 08 '15 at 01:14
4

Copy the public key on your computer i.e., ~/.ssh/id_rsa.pub (open it with notepad)

Paste this key in the "Add SSH key" section in your github account.

Note: to generate a ssh key if doesnt already exist, use ssh-keygen -t rsa

stfcodes
  • 1,380
  • 1
  • 9
  • 18
3

Can you try adding the private key using ssh-add?

Alan Haggai Alavi
  • 72,802
  • 19
  • 102
  • 127
  • I tried it and it said Could not open a connection to your authentication agent. – KT. Dec 01 '09 at 03:16
  • eval $(ssh-agent) cannot resolve any issue beacuse if agent is not runnin then Agent pid will be random number – amuliar Dec 13 '17 at 15:51
3

After a lot of googling, I found this answer. I had to start the bash engine before i can add the keys. I cloned my app from github to my local server as well.

KT.
  • 571
  • 3
  • 6
  • 19
1

Consider using ForwardAgent option.

Try add:

Host * 
    ForwardAgent yes

to /etc/ssh/ssh_config on local machine.

gayavat
  • 18,910
  • 11
  • 45
  • 55
1

If you are on Linux, you can try keychain tool to manage SSH agent.

Jakub Narębski
  • 309,089
  • 65
  • 217
  • 230
0

I had the same problem. Check the contents of your public key file:

  1. it must start with ssh-rsa
  2. it must be ONE line
  3. the format is like this: ssh-rsa manysymbolshere== somekeyname

if you generated the key using puttygen in Windows - DO NOT save public key to a file on disk - it will have comments, which you must delete before copying to a server. Copy the public key to clipboard and then save to a *.pub file using notepad.

das-g
  • 9,718
  • 4
  • 38
  • 80
Max Ivak
  • 1,529
  • 17
  • 39
-1

SSL certificate rejected trying to access GitHub over HTTPS behind firewall looks to be a very similar question. One solution I took from from those answers to quickly clone a git repository when I don't have the keys set up is to:

export GIT_SSL_NO_VERIFY=true

then clone away.

Community
  • 1
  • 1
Ian
  • 977
  • 8
  • 14