DEV Community

Joel Jucá
Joel Jucá

Posted on

2

Test your SSH-based Git auth

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 git@your-git-service.com
Enter fullscreen mode Exit fullscreen mode

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:

GitHub

$ ssh -T git@github.com
Hi joeljuca! You've successfully authenticated, but GitHub does not provide shell access.
Enter fullscreen mode Exit fullscreen mode

GitLab

ssh -T git@gitlab.com
Welcome to GitLab, @joeljuca!
Enter fullscreen mode Exit fullscreen mode

Bitbucket

ssh -T git@bitbucket.org
authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled
Enter fullscreen mode Exit fullscreen mode

Gitea

ssh -T git@gitea.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.
Enter fullscreen mode Exit fullscreen mode

sourcehut

ssh -T git@git.sr.ht
Hi joeljuca! You've successfully authenticated, but I do not provide an interactive shell. Bye!
Enter fullscreen mode Exit fullscreen mode

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 -Tv instead of ssh -T. 😉

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay