Git clone URL

why I should use git user when I want to clone project through ssh?
git clone git@myserver.com:/VsVim.git

I expect enter my own user instead of git user in url, why git work in this way?

thanks

Hi,

that’s more a technical and security related thing with SSH as transport. The git user has limited rights on the server, it may only login and do git commands, but has no real shell, etc. It collects all user permissions into a generated authorized_keys file where your public key is part of.

Imagine that every user in your Git repository would instead have a shell account and SSH access. This opens up possible exploits for many different users with different settings. Also, the system needs an automated fashion to always ensure that permissions are correct, shells are limited and so on. And there might be a problem with shells then, e.g. if your git username needs more rights and a shell, but git denies that.

Therefore it is common best practice to keep using a service user for SSH access in this regard, and allow the ACLs to work via server side hooks.

Here’s some more details I’ve just found: https://stackoverflow.com/questions/47664768/why-does-git-using-ssh-use-git-as-a-username

Cheers,
Michael

1 Like