Running a “secure” git server over SSH without gitosis/gitolite?

后端 未结 3 2167
囚心锁ツ
囚心锁ツ 2021-02-19 17:10

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/

3条回答
  •  执笔经年
    2021-02-19 18:04

    You can put this at the beginning of each line in authorized_keys2:

    no-port-forwarding,no-agent-forwarding,command="/usr/bin/git-shell -c \"$SSH_ORIGINAL_COMMAND\"" 
    

    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):

    sudo -u git -i
    

提交回复
热议问题