8

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 git@github.com: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.
Martijn Pieters
  • 889,049
  • 245
  • 3,507
  • 2,997
Cseal69
  • 139
  • 1
  • 2
  • 9

3 Answers3

5

An ssh url means:

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
Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • I have the same error even though `ssh -T git@bitbucket.org` says that I have access. – limeandcoconut Jan 20 '15 at 02:13
  • @BrassApparatus are you trying to clone a repo on bitBucket that you own? – VonC Jan 20 '15 at 06:25
  • Yes. I believe that I've found the problem... If I'm right, the issue is that I am using a non-root user for ssh-ing in. When I was attempting the clone it was with `sudo git clone [url]`. As I understand it that means that it would attempt the connection with the root user's ssh keys despite my being logged in as `devadmin`. Root's keys are not added to bitbucket yet. Does that make sense at all? – limeandcoconut Jan 20 '15 at 09:04
  • @BrassApparatus it does make sense and explain why those ssh keys aren't used. Using the same user account for git operation as the one for your `ssh -T` test should solve the issue. – VonC Jan 20 '15 at 09:13
  • Cheers! It just has.I ended up changing permissions on the repo folder to solve the problem. – limeandcoconut Jan 20 '15 at 09:58
3

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

Weisi Zhan
  • 309
  • 2
  • 9
-1

You need to use the https URL (https://github.com/...someThing). Using the one you used only works when you have push access to the repository.