Github updated its RSA SSH host key. Here is a more in-depth guide to updating the RSA key from your terminal.

Luis Dejesus Castro
3 min readMar 25, 2023

--

The original blog about the changes can be found here, along with an overview of how to correct this issue but for students just starting off in Software Engineering this may be more difficult than GitHub gives credit for. Bootcamps want to get coding as fast as possible so there is less emphasis on knowing your way around the terminal and directories. That’s why I wanted to write this student-facing blog to walk you through updating your RSA Key as well as a more detailed understanding of what all of this means.

To start off you want to open your terminal and run this command to remove the old GitHub key from your list of known hosts:

$ ssh-keygen -R github.com

This command will not display any activity in the terminal when you enter it, but it will have worked. after that, you need to update your ~/.ssh/known_hosts file to include the new RSA SSH public key. But how do we get to that file?

The path starts with ~/ which represents the Home directory. How do we get to the home directory? You do it every time you open your terminal! By opening your Ubuntu or Terminal application, you automatically see something like looks like this:

using Ubuntu

The home directory is the directory you start off in. The .ssh folder is here but when we run ls we won’t see it. That’s because the .ssh folder is a hidden folder. To see this folder we need to use the command ls -a . We use the -a flag to list all files. You should see something like this:

Now we can see the .ssh folder! At this point, we can go ahead and open our code editor and edit the known_hosts file. If you are using Visual Studio Code, you can run code . to open the editor to the home directory. Next is adding the new RSA SSH key to the file!

When you have your code editor open you should see this:

click on the .ssh folder and you should see the file called known_hosts. In that file, you are going to see a bunch of code that looks like random characters. These are the SSH keys for the other known hosts. Make sure not to modify any of this pre-existing text. Go ahead and copy GitHub’s new SSH key from their official blog:


github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=

and add it to a new line in the known_hosts file.

make sure the file is saved before closing your editor. Now if you try cloning using an SSH key, you shouldn’t have any issues authenticating github.com as a host.

--

--