Linux command
git-shell 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Set user shell to git-shell
chsh -s $(which git-shell) [git-user]
Run allowed command
git-shell -c "git-receive-pack '/repo.git'"
说明
git-shell is a restricted login shell that allows only Git operations (push, pull, fetch) over SSH while blocking general shell access. When set as a user's login shell, it prevents interactive login while permitting Git protocol operations. This is the standard way to create secure Git hosting accounts that can only interact through Git commands.
参数
- -c _COMMAND_
- Execute git command.
- --help
- Display help information.
FAQ
What is the git-shell command used for?
git-shell is a restricted login shell that allows only Git operations (push, pull, fetch) over SSH while blocking general shell access. When set as a user's login shell, it prevents interactive login while permitting Git protocol operations. This is the standard way to create secure Git hosting accounts that can only interact through Git commands.
How do I run a basic git-shell example?
Run `chsh -s $(which git-shell) [git-user]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c _COMMAND_ do in git-shell?
Execute git command.