I try to push changes from my local repo to a remote repo. When I type:
git push origin
I get the following error:
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: The remote end hung up unexpectedly
How can I solve this? I'm using git from the command line in Windows 7.
Edit
When I try to do a simple ssh
ssh user@hostname
I get the following error:
Could not create directory '/c//%HOMEDRIVE%%HOMEPATH%/.ssh'.
percent_expand: unknown key %H
Somehow it will not create the directory, because the path is invalid. How to fix this?
@eckes: Edit2
My Home is set to %HOMEDRIVE%%HOMEPATH%
is this correct?
The message means that the host key of origin
is not present in your trusted hosts file.
To get around this, open a plain SSH connection to origin
and SSH will ask you if you want to trust the remote host (from the Git console):
$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is <FINGERPRINT>.
Are you sure you want to continue connecting (yes/no)?
If you trust the remote host (i.e. type yes
), SSH will add its key to the list of known hosts.
After that, you should be able to do your git push origin
.
As an alternative, you could also manually add the key of origin
to .ssh/known_hosts
but this requires that you adhere to the format of the known_hosts
file as described in the man page of sshd
(Section AUTHORIZED_KEYS FILE FORMAT).