Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

#Gitolite on docker

How to run

There are two methods to run this image.

  1. Use docker run directly. Example:

     $ docker run -d -p 2222:22 --name gitolite -e SSH_KEY="$(cat  ~/.ssh/id_rsa.pub)"  -v /path/to/git/data:/home/git/repositories  betacz/gitolite
    
  2. Use the gitolite script from the GitHub Project.

    This script contains the following variables. You can change them by modifying this file or by use the environment variable to override.

     IMAGE_NAME            default: "betacz/gitolite"
     CONTAINER_NAME      default: "gitolite-server"
     PORT                default: "2222"
     GIT_DATA_PATH       default: "/opt/git"
     SSH_KEY_FILE        default: "$HOME/.ssh/id_rsa.pub"
    

    Example:

     # run the container
     $ GIT_DATA_PATH=/var/data/git ./gitolite start
     # stop && remove the container
     $ ./gitolite stop && ./gitolite remove
    

    The user running the script must be a member of the group docker. Otherwise, you need to modify this script and prepend sudo to the appropriate command.

Attention:

  • If you don't use your own ssh key, you can get the built-in private key by docker logs gitolite for admin user.

  • You should create a directory for persistent Git repositories. This directory must have read/write permissions for current user.

  • The Git repositories directory you specify can also be a already exists gitolite repositories.

.rc file

You can customize the gitolite .rc file by modify the /path/to/git/data/gitolite.rc. This file will sync to ~/.gitolite.rc when restart the container. So after change it you must run command like this:

   $ ./gitolite stop && ./gitolite start

Container removed?

If the container accidentally removed by docker rm or ./gitolite remove . You can start it with the command as same as before. But you must force push the gitolite-admin again.

Example:

   $ GIT_DATA_PATH=/var/data/git ./gitolite start
   $ cd ~/gitolite-admin && git push -f

Build your own image

Clone the source code and run:

   $ docker build -t gitolite .
Docker Pull Command
Owner
betacz
Source Repository

Comments (2)
jesselang
3 years ago

This image reinstalls the admin key (if SSH_KEY is defined) every time the container is started. gitolite ignores duplicate keys, which means if you install the same key as your username after installing it as admin, you won't have access to any repos as your username. Removing the admin key works until the container is started again (reboots, etc.)

I forked the project and modified start.sh to use a file to indicate whether gitolite had been configured the first time. This avoids gitolite from reinstalling the admin key on container start.

Thanks!

https://registry.hub.docker.com/u/jesselang/gitolite/ - automated build
https://github.com/hlj/docker-gitolite/pull/1 - pull request

jesselang
3 years ago

This image runs gitolite as the "git" user, which has an ID of 1000. When creating the volume directory to store your repositories, you should "chown 1000 /path/to/git/data", and be mindful to restrict ownership and permissions of parent directories to keep UID 1000 on the host from accessing your repositories.