brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ssh -T [email protected] checks your SSH key without cloning anything

Network and access
~/tips/tip-ssh-t-test-github-key

ssh -T [email protected]

Find out in one command which account your key logs in as on a Git host.

When a push fails with a permission error, I want to know whether the key works at all before I start blaming the remote URL. One command tells you.

ssh -T [email protected]

If the key is fine, GitHub answers with a greeting that includes your user name and a note that it does not offer shell access, and then closes the connection. -T tells ssh not to ask for a terminal, which avoids a pointless warning since there is no shell anyway.

The user name in that greeting is the interesting part. If you have two accounts, it tells you which one this key belongs to, and that explains a lot of “repository not found” errors on private repos.

When it fails, add -v to see which keys ssh offers:

ssh -vT [email protected]

Look for the lines with Offering public key. If your key is not in the list, the agent does not have it or your ssh config points to another file. GitLab, Codeberg and Forgejo instances answer to the same test with git@ and their own host name.

One thing to watch: the first time, ssh asks you to confirm the host key. Compare it with the fingerprints the provider publishes in its documentation before you type yes.

Further reading: Testing your SSH connection (GitHub Docs), ssh man page

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link