Gitsune (vosjedev.net)
login
To clone locally:
$ git clone https://betagit.vosjedev.net/git/gitolite-cgit-docker.git
Last commit: 48428d2e0249 Upgrade alpine linux to latest version[checkout]
NameSizeMode
.gitea/-040000
.gitignore17B100644
LICENSE34.33KiB100644
README.md6.49KiB100644
bootstrap.sh286B100644
config.env.example265B100644
docker-compose.yml254B100644
gitolite-cgit/-040000
img/-040000
README.md

gitolite-cgit based on alpine image

Fork of heckyel's image

Changes made by the fork:

Below follows the original unmodified readme. Know that to use this fork, below instructions do not apply.

What is this image?

rusian/gitolite-cgit is a Docker image with cgit in dark-mode and gitolite running on top of alpine base image.

cgit

Usage

  1. Pull the image
-
1
$ docker pull rusian/gitolite-cgit
  1. Run the image with provided environment:
-
1
$ docker run -e SSH_KEY="$(cat ~/.ssh/id_ed25519.pub)" -e SSH_KEY_NAME="$(whoami)" -p 22:22 -p 80:80 -p 9418:9418 -v repo:/var/lib/git rusian/gitolite-cgit

Environment

Exposed ports

Volume

How to interact with git server

Cgit webpage: http://<server_ip>/

Supported clone method:

Docker-compose

  1. Pull the image:
-
1
$ docker pull rusian/gitolite-cgit
  1. Create environment file

I create gitolite admin with the host public key and username.
In case, you are running this on server, you need to enter
SSH_KEY and SSH_KEY_NAME into config.env:

-
#
# Gitolite options
#
SSH_KEY=<your public key content>
SSH_KEY_NAME=<your gitolite name>
#
# Cgit options
#
CGIT_ROOT_TITLE=Git Repository Browser
CGIT_DESC=a fast webinterface for the git dscm
CGIT_CLONE_PREFIX=http://<YOUR-DOMAIN> ssh://git@<YOUR-DOMAIN>

CGIT_SNAPSHOT=tar.gz tar.bz2 tar.xz

For convience, I create a bootstrap.sh script for user who use public
key and name from the host running Docker:

-
1
2
3
4
5
6
7
8
# change ssh_key, ssh_key_name to reflect your current setup
SSH_KEY=$(cat ~/.ssh/id_ed25519.pub)
SSH_KEY_NAME=$(whoami)

sed -i.bak \
    -e "s#SSH_KEY=.*#SSH_KEY=${SSH_KEY}#g" \
    -e "s#SSH_KEY_NAME=.*#SSH_KEY_NAME=${SSH_KEY_NAME}#g" \
    "$(dirname "$0")/config.env"

Generate public key and private key:

-
1
sh bootstrap.sh
  1. Create docker-compose.yml:
-
version: '3'

services:
  app:
    image: rusian/gitolite-cgit
    container_name: gitolite-cgit
    env_file: config.env
    volumes:
      - git:/etc/ssh
      - git:/var/lib/git
    ports:
      - 22:22
      - 80:80
      - 9418:9418
    tty: true
volumes:
  git:

Then power-on your container:

-
1
$ docker-compose up -d

Customize cgit configuration

As there are many cgit configuration, you can create cgitrc configure and map to /etc/cgitrc

-
1
2
# Copy cgitrc from existing container
docker cp gitolite-cgit:/etc/cgitrc .

Modify the docker-compose.yml:

-
version: '3'

services:
  app:
    image: rusian/gitolite-cgit
    container_name: gitolite-cgit
    env_file: config.env
    volumes:
      - git:/etc/ssh
      - git:/var/lib/git
      - ./cgitrc:/etc/cgitrc
    ports:
      - 22:22
      - 80:80
      - 9418:9418
    tty: true
volumes:
  git:

Build docker image

-
1
$ git clone https://c.hgit.ga/containers/gitolite-cgit-docker.git
-
1
$ cd gitolite-cgit-docker/gitolite-cgit
-
1
$ docker build --tag rusian/gitolite-cgit -f Dockerfile .

Extra

Example of gitolite-admin/conf/gitolite.conf:

-
#-----------
#  General
#-----------
@secret         =  gitolite-admin
@hiddenrepo     =  gitolite-admin

#-----------
#  People
#-----------
@p-admin        =  paco
@p-team         =  minoru

#----------------------
#  Repositories
#----------------------
repo @hiddenrepo
     config cgit.ignore = 1

repo @secret
     - = cgit daemon
     option deny-rules = 1

repo @all
     R          =  cgit daemon

repo gitolite-admin
     RW+        =  @p-admin

repo science/numeral
     RW+                        =  @p-admin
     -   master develop         =  @p-team
     -   refs/tags/v[0-9]       =  @p-team
     RW+                        =  @p-team
     desc                       =  "Repo paco files"
     config gitweb.owner        =  paco

repo documents/operators
     RW+                        =  @p-admin
     -   master develop         =  @p-team
     -   refs/tags/v[0-9]       =  @p-team
     RW+                        =  @p-team
     desc                       =  "Repo minoru files"
     config gitweb.owner        =  minoru

#------------------------
# Personal repositories
#------------------------
repo CREATOR/[a-zA-Z0-9].*
     C                          =  @p-admin @p-team
     RW+                        =  CREATOR
     RW+                        =  @p-admin
     R                          =  @all
     config gitweb.owner        =  %GL_CREATOR

Set default branch

-
1
ssh git@gitolite-host symbolic-ref public/foo HEAD refs/heads/main

Real sample:

-
1
ssh git@c.fridu.us symbolic-ref containers/gitolite-cgit-docker HEAD refs/heads/main

Delete branch

-
1
git push origin :branch

Real sample:

-
1
git push origin :master