---
title: How to re-add Github key to a server
date: 2017-08-09T17:18:00-04:00
author: John Morton
canonical_url: "https://supergeekery.com/blog/how-to-re-add-github-key-to-a-server"
section: Blog
---
# How to re-add Github key to a server

*August 9, 2017* by John Morton

![What Did I Just Do?](https://static.supergeekery.com/site-assets/what-did-i-do.jpg)

*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.

```bash
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
```
