DEV Community

Isaac P
Isaac P

Posted on

Easily Sync Github SSH keys with your Servers

tl;dr

ssh-import-id-gh <github_username>
Enter fullscreen mode Exit fullscreen mode

I've spent too much time not know about this..

If you work on remote servers often and connect via ssh, you'll surely want to know this.

This command grabs the public keys from Github for the username provided and adds them to your authorized_keys file. So if you work on multiple machines and have your ssh keys added to Github, then you can easily update any server by simply running this command.

Maybe it was just me, but I always just edited that file manually and copied my public keys around. This is a hassle and introduces potential for mistakes.

Especially because I develop on several different machines and the dynamic nature of life, it's nice to have an easy way to sync your Github keys with the allowed keys on your servers.

Top comments (0)