A blog probably of interest only to nerds by John Morton.


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 `known_hosts` file.

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](https://stackoverflow.com/questions/13363553/git-error-host-key-verification-failed-when-connecting-to-remote-repository) 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