Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Permission Denied (publickey)

I've been trying to do this but this is what is happening every time I try to clone this.

C:\Users\Cod>git clone [email protected]:MiniCodeMonkey/Vagrant-LAMP-Stack.git
Cloning into 'Vagrant-LAMP-Stak'...
The authenticity of host 'github.com (192.30.252.128)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of know
n hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
like image 998
Cseal69 Avatar asked Sep 13 '14 22:09

Cseal69


2 Answers

An ssh url means:

  • you have created a public and private ssh keys locally (in your %HOME%\.ssh folder, make sure that HOME is defined)
  • you have registered that public key in your github ssh setting section

If you didn't created any ssh key, then as commented, you can try instead using the https url, which doesn't require any authentication (for cloning at least)

git clone https://github.com/MiniCodeMonkey/Vagrant-LAMP-Stack
like image 106
VonC Avatar answered Nov 01 '22 05:11

VonC


I was just having a similar issue, and I finally solved it.

My solution is:

First, follow the instruction here to check for existing key for Github, and create one if there isn't any. Do not just copy and paste the code, read the instruction carefully because there are some code you must modify and customize.

BTW, at this step, I was having trouble while trying to modifying my ~/.ssh/id_rsa file, but it turned out this is not a big deal. However, if you really want to store your SSH key and avoid entering it every time you push and pull, you can go to your .ssh directory and make a 'config' file by useful 'nano' and enter the following:

Host *
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa

Second, copy your SSH key to the clipboard. This step is mentioned but not illustrated in detailed step, my way to do this is:

cd ~
ls -a
cd .ssh
cat id_rsa.pub

I am sure there must be better ways, but they do not work out for me, probably because I am having trouble opening text editor within git.

Third, add the key you just generate to your Github account.

If you do all these, your git might work just fine like mine did.

All references from: https://help.github.com/articles/connecting-to-github-with-ssh/#generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

like image 4
YC Tsim Avatar answered Nov 01 '22 07:11

YC Tsim