A small trick I've always used but I realized it might not be a well-known thing.
It is possible to test your authentication against a Git service over SSH with a very simple command:
ssh -T email@example.com
That's it. Pretty simple, right!? I do it all the time, to test if my SSH key is properly configured on a given Git service (GitHub, Gitea, sourcehut, etc.)
I'll put here some examples for popular Git services, so you can test it easily:
$ ssh -T firstname.lastname@example.org Hi joeljuca! You've successfully authenticated, but GitHub does not provide shell access.
ssh -T email@example.com Welcome to GitLab, @joeljuca!
ssh -T firstname.lastname@example.org authenticated via ssh key. You can use git to connect to Bitbucket. Shell access is disabled
ssh -T email@example.com Hi there, joeljuca! You've successfully authenticated with the key named [key name here], but Gitea does not provide shell access. If this is unexpected, please log in with password and setup Gitea under another user.
ssh -T firstname.lastname@example.org Hi joeljuca! You've successfully authenticated, but I do not provide an interactive shell. Bye!
That's it :) just a small Git/SSH trick for today. I hope it saves you some seconds when you're about to test your SSH-based Git authentication again!
Pro-tip: you can use the verbose mode to look way more hackish if you're testing the authentication in front of your girlfriend. 😂 Try running
ssh -Tvinstead of
ssh -T. 😉
Top comments (0)