Github SSH access using a remote terminal

git ssh
Author

Nishan Mann

Published

April 6, 2021

To make my life easier, I recently setup ssh access to github on my desktop machine by following Github’s instructions. To test ssh access on this machine, I launched a terminal using my GNOME3 desktop environment and ran ssh -T git@github.com which returned

Hi <github_username>! You've successfully authenticated, but GitHub does not provide shell access.

However, when logging into desktop using ssh, i.e ssh user@desktop, the ssh access test above failed. Stackoverflow to the rescue! Turns out, the ssh-keys for accessing the host github.com are stored in GNOME Keyring hence when logging into the machine via ssh without GNOME3, the keys could not be found.

The solution is to create (if it doesn’t exist) a ssh config file at ~/.ssh/config and populate it using

Host github.com
  IdentityFile ~/.ssh/path_to_private_key
  IdentitiesOnly yes