1

When using git repository managers (like GitHub, GitLab, etc), the instructions to clone a project state the SSH connection for the remote as:

git@github.com:xxxx/yyyy.git

Why do these repository managers mandate using the git username (as in git@github.com), rather than using my specific username?

When it comes to authenticating my request, my public/private key auth must have to be checked against the universe of all users?

jwa
  • 3,239
  • 2
  • 23
  • 54

2 Answers2

5

Git does not have its own authentication built in. Git simply uses whatever the operating system provides.

At the operating system level, using a Linux server, you would only be able to ssh <server> as yourself if you yourself have an account on that Linux server. I suspect you do not have an account on GitHub's servers. :-) But some guy named git does.

His log-in shell, though, is not a regular command shell. It will not run general Linux commands. When git (is that John Git, or is it Git Smith?) logs in, "his" "shell" is redirected (actually through ssh itself) to a separate program, not part of Git, that compares the incoming keys against—yes, you got it—all keys for all users. That lets his shell figure out that, no, it's not John Git, it's jwa. It's that shell, or another part spawned from it, that gives jwa access to jwa's repositories.

The gitolite code (mostly written in Perl) provides an example of how to do this on any Unix-like server. Once you get past a few hundred authorized keys, though, it's probably wise to stop using linear searches to look up keys, i.e., to stop using the stuff built in to sshd itself. Looking up the key in a database will be a lot faster.

torek
  • 448,244
  • 59
  • 642
  • 775
1

As @torek answer above git has its own transfer protocol and beside the one he describes git also use gitosis

https://git-scm.com/book/no-nb/v1/Git-on-the-Server-Gitosis

gitosis is written in python and is a tool which provides access control and remote management for hosted Git repositories.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 1
    Worth noting, I think: both gitosis and gitolite are add-ons to Git. [Gitosis seems less maintained and less featureful.](http://stackoverflow.com/a/10888358/1256452) One former colleague suggested that perhaps gitolite is the cure for gitosis. :-) (The name "gitosis" sounds suspiciously similar to [halitosis](http://www.dictionary.com/browse/halitosis).) – torek Apr 16 '17 at 01:01