2

I tried to pull project from github to my local repository.

I generated all necessary ssh keys. And I cloned this project. but when I tried to pull changes I caught:

$ git pull
The authenticity of host 'github.com (192.30.252.129)' 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.129' (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.

here is content of .ssh:

Directory of C:\Users\nlel.ssh

15.01.2014  13:35    <DIR>          .
15.01.2014  13:35    <DIR>          ..
09.01.2014  15:24             1 675 github_rsa
09.01.2014  15:24               391 github_rsa.pub
09.01.2014  13:08             1 751 id_rsa
09.01.2014  13:08               405 id_rsa.pub
15.01.2014  13:36               803 known_hosts
               5 File(s)          5 025 bytes
               2 Dir(s)  59 142 991 872 bytes free

They are presented at github account. And I cloned project ok.

Solution:

I recreated my keys. And generated them again, using key phrase.
I deleted old keys from pc and github and added new.

And all works now. Tricky point is that this repo was private.

- Why does this happen?
- How to solve this trouble?

catch23
  • 17,519
  • 42
  • 144
  • 217

1 Answers1

3

ssh would only seek %HOME%\.ssh\id_rsa(.pub)

If you want ssh to pick a different set of keys, you need to declare those in a %HOME\.ssh\config file (which I don't see in your dir).

That config file would include something like:

Host github
  HostName github.com
  User git
  IdentityFile C:\path\to\.ssh\github_rsa
  IdentitiesOnly yes

Rename the url of your 'origin' remote with a:

cd /path/to/my/repo
git remote set-url origin github:yourName/YourRepo.git

This is needed for pushing (writing to) a GitHub repo that you own.
You wouldn't need ssh keys at all for pulling (reading) from a public repo.


In the OP nazar-art's case, the keys weren't probably the right ones, and recreating those was enough:

I recreated my keys. And generated them again, using key phrase.
I deleted old keys from pc and github and added new.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250