Is it possible to run a git server over ssh, using authorized_keys
and command=
to restrict access to only the git repositories, without using gitosis/gitolite?
相关问题
- JavaScript File Transfer SSH
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
相关文章
- 请教Git如何克隆本地库?
- Check if directory exists on remote machine with s
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
You can put this at the beginning of each line in
authorized_keys2
:That'll allow only git commands over ssh, but will still let you become that user if you need to mess around (from another account):
Yes, assign the
git shell
as the login shell for all users which shall only have git access.EDIT: Not sure about all of the sudden negative rankings; I am obviously not saying to use Gitolite as the OP specifically asked not to use it. I am simply stating that what he is asking for is 95% of what Gitolite's tiny source code does and hence I'm telling him where in it's source he can find the snippet he would want to copy to roll his own.
Yes, gitolite does exactly just that. It doesn't swap out the user's shell either.
Notice this doesn't look like a normal
authorized_keys
on the server, it also passes the username as a parameter so that the executed script knows who this ssh key belongs to. The additional benefit of not switching the user's shell (while still keeping it secure) is that if you try to ssh directly into the machine it will not only terminate the session but tell you which repos you have access to before it terminates, if it knows who you are.