Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Terminal MessageÂ
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is
SHA256:……………………………………………………….
Please contact your system administrator. Add correct host key in /home /.ssh/known_hosts to get rid of this message. Offending RSA key in /home/.ssh/known_hosts:1 remove with:
ssh-keygen -f “/home/.ssh/known_hosts” -R “github.com” RSA host key for github.com has changed and you have requested strict checking. Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Solution
It might be possible to your are trying to push or pull from different user authorities or terminal so, you need to change ssh key or using the same IDE or terminal which has ssh is set.
I had a similar problem, but I was using SSH keys. I discovered that the problem is caused by a missing known hosts file or github.com not being included in the list of known hosts. Here are the steps I took to solve it:
/.ssh ssh-keyscan -t rsa mkdir -p >> github.com /.ssh/known hosts ssh-keygen -t rsa -C “user.email” opens the public key. $ cat /.ssh/id rsa.pub and copy the result. Add the id rsa.pub key to your GitHub profile’s SSH keys list. You can also try delete old ones and use new ones ssh .