MasterNone
MasterNone

Reputation: 568

Sublime Git pushing host key verification failed

So basically I pushed my project to gitlab by sublimegit.

Now I made a format to my windows7 and installed windows10, I placed the project folder in the same path as I used to have on old OS.

I have the privatekey from which I can generate id_rsa - I checked it and it also generates the same public key to gitlab.

I placed id_rsa to Users/Me/.ssh folder and to Program files/Git/etc/ssh and also created a folder in Git called .ssh and place it in there also.

Pushing to [email protected]:HTML/stuff.git
Host key verification failed.

fatal: Could not read from remote repository.

Can anyone see what kinda mistake I'm doing?

Upvotes: 5

Views: 13438

Answers (3)

VonC
VonC

Reputation: 1326746

You should have id_rsa (private key) and id_rsa.pub (public key) both in C:/Users/Me/.ssh

Check that then environment variable HOME is defined (to %USERPROFILE%), which should be the case if you are calling git-cmd.bat or git-bash.bat, packaged in the latest git for Windows.

As mentioned by the OP, and seen in this question, you also need to add the server key in the C:/Users/Me/.ssh/known_host file.

ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts

(this is what the step 5 of GitHub SSH / Generating SSH keys does: that applies also for a gitlab server)

Warning March 2023:

"GitHub has updated its RSA SSH host key"


Upvotes: 12

chaos_li
chaos_li

Reputation: 9

You might install two (github.exe/ git.exe) clients,just try to move out the new one from PATH

Upvotes: 0

MasterNone
MasterNone

Reputation: 568

Basically I just needed known_hosts

ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts

Upvotes: 3

Related Questions