If you’re running Arch Linux and want to set up SSH authentication for GitHub, here’s a quick guide to get you started. This process allows you to push and pull from GitHub repositories without entering your password every time.
Prerequisites
First, you’ll need to install OpenSSH if it’s not already on your system:
sudo pacman -S openssh
Generate Your SSH Key
Create a new ED25519 SSH key pair with this command:
ssh-keygen -t ed25519 -C "[email protected]"
Replace [email protected] with your actual GitHub email. When prompted, you can accept the default location or specify a custom path. I recommend setting a passphrase for additional security.
Add the Key to SSH Agent
Start the SSH agent and add your newly created key:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
Copy Your Public Key
Display your public key:
cat ~/.ssh/id_ed25519.pub
Copy the entire output to your clipboard.
Add Key to GitHub
- Navigate to GitHub Settings → SSH and GPG keys
- Click “New SSH key”
- Give it a descriptive title (e.g., “Arch Linux Workstation”)
- Paste your public key
- Click “Add SSH key”
Verify the Connection
Test your SSH connection to GitHub:
ssh -T [email protected]
You should see a success message confirming authentication.
Start Using SSH URLs
Now you can clone repositories using SSH instead of HTTPS:
git clone [email protected]:username/repository.git
That’s it! You’re all set to work with GitHub using SSH authentication on Arch Linux.