Member-only story

Setting up SSH on Ubuntu for GitHub access

Matthew Morgan
Jan 21, 2025

--

How to allow GitHub access to a Ubuntu instance

Generate a new SSH key pair.

Optionally set location and password. For this example, we will choose the default.

ssh-keygen -t ed25519 -C "your_email@example.com"

Start the SSH agent

eval "$(ssh-agent -s)"

Add the key

ssh-add ~/.ssh/id_ed25519

Copy the key and add it to GitHub.

Github.com -> Settings -> SSH and GPG keys -> New SSH key

cat ~/.ssh/id_ed25519.pub

Test connection

ssh -T git@github.com

# should show:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

Configure ssh

vi ~/.ssh/config

Add this:

Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519

--

--

Matthew Morgan
Matthew Morgan

Written by Matthew Morgan

Software Engineer | Hire Me!!

No responses yet

Write a response