170 lines
4.6 KiB
HTML
170 lines
4.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GIT-SHELL</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GIT-SHELL</H1>
|
|
Section: Git Manual (1)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
git-shell - Restricted login shell for Git-only SSH access
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<PRE>
|
|
<I>chsh</I> -s $(command -v git-shell) <user>
|
|
<I>git clone</I> <user><B>@localhost:/path/to/repo.git</B>
|
|
<I>ssh</I> <user><B>@localhost</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
This is a login shell for SSH accounts to provide restricted Git access. It permits execution only of server-side Git commands implementing the pull/push functionality, plus custom commands present in a subdirectory named <B>git-shell-commands</B> in the user's home directory.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>COMMANDS</H2>
|
|
|
|
<P>
|
|
<I>git shell</I> accepts the following commands after the <B>-c</B> option:
|
|
<P>
|
|
|
|
<I>git receive-pack <argument></I>, <I>git upload-pack <argument></I>, <I>git upload-archive <argument></I>
|
|
<DL COMPACT><DT id="1"><DD>
|
|
Call the corresponding server-side command to support the client's
|
|
<I>git push</I>,
|
|
<I>git fetch</I>, or
|
|
<I>git archive --remote</I>
|
|
request.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<I>cvs server</I>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
Imitate a CVS server. See
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-cvsserver">git-cvsserver</A></B>(1).
|
|
</DL>
|
|
|
|
<P>
|
|
If a <B>~/git-shell-commands</B> directory is present, <I>git shell</I> will also handle other, custom commands by running "<B>git-shell-commands/<command> <arguments></B>" from the user's home directory.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>INTERACTIVE USE</H2>
|
|
|
|
<P>
|
|
By default, the commands above can be executed only with the <B>-c</B> option; the shell is not interactive.
|
|
<P>
|
|
If a <B>~/git-shell-commands</B> directory is present, <I>git shell</I> can also be run interactively (with no arguments). If a <B>help</B> command is present in the <B>git-shell-commands</B> directory, it is run to provide the user with an overview of allowed actions. Then a "git> " prompt is presented at which one can enter any of the commands from the <B>git-shell-commands</B> directory, or <B>exit</B> to close the connection.
|
|
<P>
|
|
Generally this mode is used as an administrative interface to allow users to list repositories they have access to, create, delete, or rename repositories, or change repository descriptions and permissions.
|
|
<P>
|
|
If a <B>no-interactive-login</B> command exists, then it is run and the interactive shell is aborted.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
To disable interactive logins, displaying a greeting instead:
|
|
<P>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ 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
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<P>
|
|
To enable git-cvsserver access (which should generally have the <B>no-interactive-login</B> example above as a prerequisite, as creating the git-shell-commands directory allows interactive logins):
|
|
<P>
|
|
<DL COMPACT><DT id="4"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ 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
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
<A HREF="/cgi-bin/man/man2html?1+ssh">ssh</A>(1), <B><A HREF="/cgi-bin/man/man2html?1+git-daemon">git-daemon</A></B>(1), contrib/git-shell-commands/README
|
|
<A NAME="lbAI"> </A>
|
|
<H2>GIT</H2>
|
|
|
|
<P>
|
|
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="8"><A HREF="#lbAE">COMMANDS</A><DD>
|
|
<DT id="9"><A HREF="#lbAF">INTERACTIVE USE</A><DD>
|
|
<DT id="10"><A HREF="#lbAG">EXAMPLES</A><DD>
|
|
<DT id="11"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="12"><A HREF="#lbAI">GIT</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:14 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|