{
    "content": [
        {
            "type": "text",
            "text": "# GIT-SHELL(1) (man)\n\n## NAME\n\ngit-shell - Restricted login shell for Git-only SSH access\n\n## SYNOPSIS\n\nchsh -s $(command -v git-shell) <user>\ngit clone <user>@localhost:/path/to/repo.git\nssh <user>@localhost\n\n## DESCRIPTION\n\nThis is a login shell for SSH accounts to provide restricted Git access. It permits execution\nonly of server-side Git commands implementing the pull/push functionality, plus custom\ncommands present in a subdirectory named git-shell-commands in the user’s home directory.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **COMMANDS**\n- **INTERACTIVE USE**\n- **EXAMPLES**\n- **SEE ALSO**\n- **GIT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "GIT-SHELL",
        "section": "1",
        "mode": "man",
        "summary": "git-shell - Restricted login shell for Git-only SSH access",
        "synopsis": "chsh -s $(command -v git-shell) <user>\ngit clone <user>@localhost:/path/to/repo.git\nssh <user>@localhost",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "To disable interactive logins, displaying a greeting instead:",
            "$ chsh -s /usr/bin/git-shell",
            "$ mkdir $HOME/git-shell-commands",
            "$ cat >$HOME/git-shell-commands/no-interactive-login <<\\EOF",
            "#!/bin/sh",
            "printf '%s\\n' \"Hi $USER! You've successfully authenticated, but I do not\"",
            "printf '%s\\n' \"provide interactive shell access.\"",
            "exit 128",
            "EOF",
            "$ chmod +x $HOME/git-shell-commands/no-interactive-login",
            "To enable git-cvsserver access (which should generally have the no-interactive-login example",
            "above as a prerequisite, as creating the git-shell-commands directory allows interactive",
            "logins):",
            "$ cat >$HOME/git-shell-commands/cvs <<\\EOF",
            "if ! test $# = 1 && test \"$1\" = \"server\"",
            "then",
            "echo >&2 \"git-cvsserver only handles \\\"server\\\"\"",
            "exit 1",
            "fi",
            "exec git cvsserver server",
            "EOF",
            "$ chmod +x $HOME/git-shell-commands/cvs"
        ],
        "see_also": [
            {
                "name": "ssh",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ssh/1/json"
            },
            {
                "name": "git-daemon",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-daemon/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "COMMANDS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "INTERACTIVE USE",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "git-shell - Restricted login shell for Git-only SSH access\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "chsh -s $(command -v git-shell) <user>\ngit clone <user>@localhost:/path/to/repo.git\nssh <user>@localhost\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is a login shell for SSH accounts to provide restricted Git access. It permits execution\nonly of server-side Git commands implementing the pull/push functionality, plus custom\ncommands present in a subdirectory named git-shell-commands in the user’s home directory.\n",
                "subsections": []
            },
            "COMMANDS": {
                "content": "git shell accepts the following commands after the -c option:\n\ngit receive-pack <argument>, git upload-pack <argument>, git upload-archive <argument>\nCall the corresponding server-side command to support the client’s git push, git fetch,\nor git archive --remote request.\n\ncvs server\nImitate a CVS server. See git-cvsserver(1).\n\nIf a ~/git-shell-commands directory is present, git shell will also handle other, custom\ncommands by running \"git-shell-commands/<command> <arguments>\" from the user’s home\ndirectory.\n",
                "subsections": []
            },
            "INTERACTIVE USE": {
                "content": "By default, the commands above can be executed only with the -c option; the shell is not\ninteractive.\n\nIf a ~/git-shell-commands directory is present, git shell can also be run interactively (with\nno arguments). If a help command is present in the git-shell-commands directory, it is run to\nprovide the user with an overview of allowed actions. Then a \"git> \" prompt is presented at\nwhich one can enter any of the commands from the git-shell-commands directory, or exit to\nclose the connection.\n\nGenerally this mode is used as an administrative interface to allow users to list\nrepositories they have access to, create, delete, or rename repositories, or change\nrepository descriptions and permissions.\n\nIf a no-interactive-login command exists, then it is run and the interactive shell is\naborted.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "To disable interactive logins, displaying a greeting instead:\n\n$ chsh -s /usr/bin/git-shell\n$ mkdir $HOME/git-shell-commands\n$ cat >$HOME/git-shell-commands/no-interactive-login <<\\EOF\n#!/bin/sh\nprintf '%s\\n' \"Hi $USER! You've successfully authenticated, but I do not\"\nprintf '%s\\n' \"provide interactive shell access.\"\nexit 128\nEOF\n$ chmod +x $HOME/git-shell-commands/no-interactive-login\n\n\nTo enable git-cvsserver access (which should generally have the no-interactive-login example\nabove as a prerequisite, as creating the git-shell-commands directory allows interactive\nlogins):\n\n$ cat >$HOME/git-shell-commands/cvs <<\\EOF\nif ! test $# = 1 && test \"$1\" = \"server\"\nthen\necho >&2 \"git-cvsserver only handles \\\"server\\\"\"\nexit 1\nfi\nexec git cvsserver server\nEOF\n$ chmod +x $HOME/git-shell-commands/cvs\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "ssh(1), git-daemon(1), contrib/git-shell-commands/README\n",
                "subsections": []
            },
            "GIT": {
                "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                                 GIT-SHELL(1)",
                "subsections": []
            }
        }
    }
}