ssh2http

A restricted login shell for Git-only SSH access, which delegates git pull/push requests to a git http backend.

Gem Version Build Status Code Climate codecov.io

Installation

Add this line to your application's Gemfile:

gem 'ssh2http'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ssh2http

Usage

Add this line to your ~/.ssh/authorized_keys:

command="source $HOME/.profile && cd <your_project_path> && bundle exec ssh2http <HTTP destination>",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty <your_pub_key>

Or if you prefer to install the gem globally:

command="source $HOME/.profile && ssh2http <HTTP destination>",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty <your_pub_key>

For example,

command="source $HOME/.profile && cd /Users/pmq20/ssh2http && bundle exec ssh2http http://localhost",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa XXXXXXXXXXXXXXXXXXXX [email protected]

Then:

git clone pmq20@localhost:/path/to/repo.git

and the request will be delegated to http://localhost/path/to/repo.git.