Skip to content

Instantly share code, notes, and snippets.

@mhofman
Last active September 5, 2018 03:48
Show Gist options
  • Save mhofman/fe372af3f1830fd9fa9cbbe7d98d1af2 to your computer and use it in GitHub Desktop.
Save mhofman/fe372af3f1830fd9fa9cbbe7d98d1af2 to your computer and use it in GitHub Desktop.
Execute custom install of git from ssh

Execute custom install of git and/or force git-shell from ssh.

Relies on using a dedicated SSH key to access the server using git.

#!/bin/sh
export PATH=$HOME/opt/usr/bin:$PATH
export GIT_EXEC_PATH=$HOME/opt/usr/libexec/git-core
command="./gitserve",no-port-forwarding,no-agent-forwarding,no-X11-forwarding ssh-rsa AAAA... rsa-git@host
#!/bin/sh
source $HOME/.bashrc
if [ -z "$SSH_ORIGINAL_COMMAND" ]; then
exec git-shell
else
exec git-shell -c "$SSH_ORIGINAL_COMMAND"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment