How to re-add Github key to a server
Note to self: Don’t erase your
knownhosts file. (headslap!)
I provision servers with Laravel Forge and messed up my deployment from Github recently. I was messing around in the
.ssh folder on my server and deleted the
The next time I tried to deploy my code base from Github though, I got the following error.
Host key verification failed. fatal: Could not read from remote repository.
I needed to get my server to “recognize” Github as a known host again and wasn’t sure how to do that. Google pointed me to this solution on StackExchange.
After logging into my remote server via SSH, this command got Github safely back into my known hosts.
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
Link to this page