0

I have a github repo, like https://github.com/username/reponame

I have also added my SSH key to the repo in the settings.

Using:

git remote -v

I get:

reponame        git@github.com:username/reponame.git (fetch)
reponame        git@github.com:username/reponame.git (push)

I've made a test.txt in the repo root on Github to test fetching.

Using the git command in Windows CMD in the local project folder (which was copied earlier from the repo manually),

git fetch reponame

I get:

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Connection abandoned.
fatal: Could not read from remote repository.

I've found same questions but none of them could clear the picture for me.

Any suggestion what am I missing here?

MattSom
  • 2,097
  • 5
  • 31
  • 53
  • 2
    Possible duplicate of [git - Server host key not cached](https://stackoverflow.com/questions/4931384/git-server-host-key-not-cached) – Wander Nauta Oct 05 '19 at 13:29
  • @WanderNauta I've found this post, that answer makes no sense to me. How do I see the hostkey of my ```projectname```? – MattSom Oct 05 '19 at 13:39
  • 1
    In your case, you would try `ssh git@github.com`. It should ask you whether you want to continue connecting. Answering yes adds the host key. If GitHub then greets you with your username, `git fetch` should now succeed. – Wander Nauta Oct 05 '19 at 13:49
  • @WanderNauta Already tried that: ```PTY allocation request failed on channel 0 Hi Username! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.``` – MattSom Oct 05 '19 at 13:54
  • 1
    Yes, like I said, GitHub has now greeted you with your username. The `git fetch` should now succeed. – Wander Nauta Oct 05 '19 at 13:55
  • @WanderNauta Thanks for trying to help, but it does not. I'm sure I'm missing something. ```git fetch``` does nothing, and ```git fetch reponame``` shows the same message. – MattSom Oct 05 '19 at 14:07

1 Answers1

0

I don't know why, but changing to HTTPS instead of SSH access has worked.

git remote rm reponame
git remote add reponame https://github.com/username/reponame.git
MattSom
  • 2,097
  • 5
  • 31
  • 53