Step-by-Step on how to Link SSH to GitHub from Your Server
Sospeter Mong'are

Sospeter Mong'are @msnmongare

About: Software Engineer passionate about developing for the web

Location:
Kenya
Joined:
Nov 22, 2018

Step-by-Step on how to Link SSH to GitHub from Your Server

Publish Date: May 21
2 0

When you use SSH to clone a GitHub repository on your server, you’re authenticating the server to GitHub using an SSH key. Here's how it's linked:


🔁 What’s Actually Happening?

  1. You generate an SSH key pair on your server.
  • The private key stays on the server.
  • The public key is copied to GitHub.
  1. When you run a command like:
   git clone git@github.com:your-username/your-repo.git
Enter fullscreen mode Exit fullscreen mode

GitHub checks:

  • “Does this public key match one of the authorized SSH keys on this GitHub account?”
  • If yes, access is granted, and cloning happens without asking for a username/password.

🔐 Step-by-Step: Link SSH to GitHub from Your Server

✅ 1. On your Contabo server, generate an SSH key:

ssh-keygen -t rsa -b 4096 -C "your-email@example.com"
Enter fullscreen mode Exit fullscreen mode

Press Enter for all prompts to accept defaults.


✅ 2. Copy the public key:

cat ~/.ssh/id_rsa.pub
Enter fullscreen mode Exit fullscreen mode

Copy the output (it begins with ssh-rsa...).


✅ 3. Go to GitHub → SettingsSSH and GPG keysNew SSH key

  • Title: Contabo server
  • Paste the key

✅ 4. Back on the server, test the connection:

ssh -T git@github.com
Enter fullscreen mode Exit fullscreen mode

If successful, it will say:

Hi your-username! You've successfully authenticated...
Enter fullscreen mode Exit fullscreen mode

✅ 5. Now you can clone your repo using SSH:

git clone git@github.com:your-username/your-django-repo.git tunaresq_be
Enter fullscreen mode Exit fullscreen mode

No username/password will be required — it just works 🎉.

Comments 0 total

    Add comment