#git #cli #vcs

app gmg

git repo command-line manager

3 releases

0.1.2 May 22, 2023
0.1.1 May 18, 2023
0.1.0 Mar 18, 2023

#3 in #vcs

Download history 18/week @ 2023-03-17 4/week @ 2023-03-24 2/week @ 2023-03-31 4/week @ 2023-04-14 2/week @ 2023-04-21 3/week @ 2023-05-05 28/week @ 2023-05-12 47/week @ 2023-05-19 17/week @ 2023-05-26

95 downloads per month



gmg - Super-lightweight git manager

The idea

The idea is simple: no extra server layer, no extra proxies. Just a pure git and ssh.


The setup scripts are made for Debian/Ubuntu systems

  • Launch a blank Debian/Ubuntu container

  • gmg requires the system git 2.34 or above. So use either a modern system or install the newer git manually.

  • Setup ssh server

  • Download a gmg binary from the releases and put it somewhere e.g. to /usr/local/bin/

  • Copy to the container the "share" folder from the repository

  • Execute on the container (where org is your organization and org.com is your organization domain):

cd share && ./gmg-setup git@org git@org.com

and that is it.

The setup creates /git folder for repositories and configures the global update hook to protect branches.

Quick start

Creating a new repository

gmg repo create test -D "My test repo"

The repository path can contain groups. E.g. "tests/test". gmg uses repository names as POSIX groups to manage access, so a full repository name (including groups) can not be longer than 30 symbols.

Creating a user

gmg user create bob "Bob M" -

Copy-paste the public ssh key-file to stdin (or use a file name instead of "-" argument)

Granting user access to a repository

gmg user grant bob test


Repositories can be cloned as

git clone ssh://bob@server/git/test

Additionally, users get symbolic links created in their homes as soon as access has been granted:

git clone ssh://bob@server:test

Setting user as the maintainer

Maintainers can write to protected branches, for others it is forbidden.

gmg maintainer set bob test

Other operations


gmg -h

for all possible commands.

Integrating with cgit

gmg automatically generates cgit-compatible configs. The configs are generated individually for each user, using /etc/cgitrc as the base one.

  • Install cgit and NGINX
apt -y install cgit nginx fcgiwrap
  • Put share/cgit-gmg.cgi into /usr/local/bin/

  • Use the following NGINX config:

server {
    listen                80;
    rewrite ^/(.*)/$ https://your-external.domain/$1 permanent;
    rewrite ^/cgit-css/(.*) /$1 last;
    root                  /usr/share/cgit;
    try_files             $uri @cgit;

    auth_pam              "Git";
    auth_pam_service_name "nginx";

    location @cgit {
      include             fastcgi_params;
      fastcgi_param       SCRIPT_FILENAME /usr/local/bin/cgit-gmg.cgi;
      fastcgi_param       PATH_INFO       $uri;
      fastcgi_param       QUERY_STRING    $args;
      fastcgi_param       HTTP_HOST       $server_name;
      fastcgi_pass        unix:/var/run/fcgiwrap.socket;
  • To let users use cgit, they must have system passwords set


~52K SLoC