Skip to content

Node setup: SSH access to GitHub and repo clone

How to give a new or rebuilt node access to this repo.

1. Generate an SSH key on the node

ssh-keygen -t ed25519 -C "hostname-of-this-node"

Accept the default path (~/.ssh/id_ed25519). Use a passphrase or leave empty depending on your threat model.

2. Add the public key to GitHub

Print the public key:

cat ~/.ssh/id_ed25519.pub

Then go to GitHub → Settings → SSH and GPG keys → New SSH key, paste the key, and give it a descriptive title (e.g. the node hostname).

3. Verify the connection

ssh -T git@github.com

Expected output:

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

Tip: The first time you connect, SSH will ask you to confirm GitHub's host fingerprint. Type yes — this is normal and only happens once.

4. Clone the repo

sudo mkdir -p /opt/homelab
sudo chown $(whoami):$(id -gn) /opt/homelab
git clone git@github.com:<org>/<repo>.git /opt/homelab

Verify:

cd /opt/homelab && git status

Common mistakes

Symptom Cause Fix
Could not resolve hostname github.com:org/repo.git Using ssh instead of git clone — the user@host:path syntax is git-specific, not an SSH URL Use git clone git@github.com:…
fatal: not a git repository Running git remote commands outside a cloned repo cd into the repo first, or clone it if it doesn't exist yet
Permission denied (publickey) Key not added to GitHub, or wrong key being offered Check ssh -vT git@github.com and verify the key is in GitHub settings
Host key verification failed GitHub's fingerprint changed or known_hosts is missing Compare the fingerprint with GitHub's published keys