I deleted the known_hosts file from .ssh folder and I can't pull or push in BitBucket repositories

bitbucket, git, key, ssh

Solution

Try executing:

ssh -T git@bitbucket.org

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.

Verifying Host Fingerprint

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.

Problem

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?

Original source