grm

git repo manager for self-hosted git servers
git clone git://sink.krj.st/grm
Log | Files | Refs | README | LICENSE

README (4094B)


      1 git repo manager
      2 ================
      3 
      4 grm is a minimal, POSIX-compliant shell script for managing git repositories on
      5 self-hosted git servers. It is mainly designed to work with git daemon [1] and
      6 stagit [2], though you don't necessarily need them to run the script.
      7 
      8 Installation
      9 ------------
     10 
     11 Before installing grm, make sure you have set up your git server following the
     12 instructions in section 4.4 [3] of Pro Git. Optionally, you should also have
     13 git daemon [1] ready for the public access of the repositories, which is
     14 documented in section 4.5 [4] of Pro Git. Your git repositories root should
     15 have the following structure:
     16 
     17   $GRM_REPOS_ROOT
     18   ├── private-repo.git
     19   │   ├── branches
     20   │   ├── HEAD
     21   │   └── ...
     22   ├── public-repo.git
     23   │   ├── branches
     24   │   ├── HEAD
     25   │   ├── ...
     26   │   └── git-daemon-export-ok
     27   └── unlisted-repo.git
     28       ├── branches
     29       ├── HEAD
     30       ├── ...
     31       ├── git-daemon-export-ok
     32       └── stagit-no-index
     33 
     34 If you want to have a web interface for your repositories, you should also have
     35 stagit [2] compiled and installed on your server.
     36 
     37 To use git repo manager, edit the grm script to fill in some configurations,
     38 
     39   # root directory of git repositories
     40   GRM_REPOS_ROOT="/home/git"
     41 
     42   # default owner
     43   GRM_OWNER="yourname"
     44 
     45   # default url prefix (without ending slash)
     46   GRM_URL_PREFIX="git://git.domain.tld"
     47 
     48   # path of the post-receive hooks for stagit
     49   GRM_POSTRECV_HOOK="/home/git/.post-receive"
     50 
     51   # root directory of stagit web pages
     52   STAGIT_WEB_ROOT="/srv/git"
     53 
     54 then
     55 
     56   $ make install
     57 
     58 An example of the post-receive hook for stagit can be found here [5]. Note that
     59 the hook itself needs some further configuration.
     60 
     61 Usage
     62 -----
     63 
     64   $ grm help
     65   usage: grm <command> [<args>]
     66 
     67   Git repo manager, manage git repositories on self-hosted git servers.
     68 
     69   commands:
     70       new                  create a new repo
     71       info repo_name       display metadata of the repo
     72       ls                   list all repos
     73       ls public            list public repos
     74       ls private           list private repos
     75       ls unlisted          list unlisted repos
     76       rm repo1 [repo2..]   remove repos
     77       rc                   recompile stagit index
     78       rc repo1 [repo2..]   recompile stagit pages for repos,
     79                            and recompile index
     80       rca                  recompile all public repos
     81       help                 show help
     82 
     83 If you have created a git user for managing git repositories, make sure the git
     84 user has write access to all the directories in the config, and run the script
     85 on the server as:
     86 
     87   $ doas -u git -- grm <command> [<args>]
     88 
     89 or
     90 
     91   $ sudo -u git -- grm <command> [<args>]
     92 
     93 You could also run the script on your local machine using ssh,
     94 
     95   $ ssh git@domain.tld -- grm <command> [<args>]
     96 
     97 or simply create an alias if you find it cumbersome:
     98 
     99   alias grm="ssh git@domain.tld -- grm"
    100 
    101 Examples
    102 --------
    103 
    104 $ grm new
    105 repo name
    106 > grmr
    107 visibility:
    108   1) public
    109   2) private
    110   3) unlisted (hide from index)
    111 enter index [default: 1]
    112 > 1
    113 description [a work in progress]
    114 > grm redux
    115 owner [yourname]
    116 > kst
    117 clone url [git://domain.tld/grmr]
    118 > git://git.domain.tld/grmr
    119 Initialized empty Git repository in /home/git/grmr.git/
    120 writing stagit metadata...
    121 setting visibility...
    122 installing stagit post-receive hook...
    123 done!
    124 
    125 $ grm ls
    126 grm
    127 grmr
    128 
    129 $ grm info grmr
    130 name: grmr
    131 visibility: public
    132 description: grm redux
    133 owner: kst
    134 url: git://git.domain.tld/grmr
    135 
    136 $ grm rc grmr
    137 [grmr] recompiling stagit pages...
    138 [index] rebuilding index...
    139 [grmr] done!
    140 [index] done!
    141 recompilation done!
    142 
    143 $ grm rm grmr
    144 remove grmr? [y/N] y
    145 [index] rebuilding index...
    146 [index] done!
    147 
    148 $ grm ls
    149 grm
    150 
    151 License
    152 -------
    153 
    154 grm is licensed under the MIT license.
    155 
    156 [1]: https://git-scm.com/docs/git-daemon
    157 [2]: https://codemadness.org/git/stagit/
    158 [3]: https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
    159 [4]: https://git-scm.com/book/en/v2/Git-on-the-Server-Git-Daemon
    160 [5]: https://sink.krj.st/stagit/file/post-receive.html