I made a mistake and deleted the "known_hosts" file in ".ssh" folder! Now I can't pull or push in BitBucket repositories.
How can I solve it?
Windows with PuTTYNavigate to HKEY_CURRENT_USER/SOFTWARE/SimonTatham/PuTTy/SshHostKeys. Right click the offending key and click delete.
Definition(s): A file associated with a specific account that contains one or more host keys. Each host key is associated with an SSH server address (IP or hostname) so that the server can be authenticated when a connection is initiated.
ssh/known_hosts or notepad ~/. ssh/known_hosts ), simply delete the complete line which has the reference to the host you want to remove and save the file.
authorized_keys is a file that allows you to add ssh public keys of users that should be allowed to log into your server (the server in which the authorized_keys file lives) using key based auth. known_hosts is a file that contains a list of keys from... known hosts that you have logged into.
Try executing:
ssh -T [email protected]
It would give you a message somethign like:
The authenticity of host 'bitbucket.org (207.223.240.181)' can't be established.
RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
Are you sure you want to continue connecting (yes/no)? yes
Say yes
after verifying the host fingerprint (see details in the end).
Then you should get this warning, which you can ignore safely:
Warning: Permanently added 'bitbucket.org,207.223.240.181' (RSA) to the list of known hosts.
conq: logged in as tuxdude.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
Try running the git pull
or git push
once again and it should work this time.
NOTE: I assume you still have your .ssh/id_rsa
file safely which is your private key for SSH authentication.
As @Pascal_dher pointed out, you can be a victim of man-in-the-middle attack if you do not verify the host's fingerprint (using some out of band approach that you can rely on). For bitbucket, the info is available here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With