Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Gitblit & Docker

These instructions assume you are running Linux and you have already installed Docker.

Running Gitblit in Docker

You can use the official Gitblit Docker image.

See the Docker Hub Readme for more detailed usage information.

Start a Gitblit instance

sudo docker pull gitblit/gitblit:rpc
sudo docker run -d --name gitblit -p 8443:8443 -p 8080:8080 -p 9418:9418 -p 29418:29418 gitblit/gitblit:rpc

The followings commands should retrieve and execute the Gitblit image and launch Gitblit in a Docker container that serves the web UI on ports 8080 and 8443. Your repositories will also be accessible via ssh, http, https, and the git procotol. The RPC administration interface has also been enabled so that you may use the Gitblit Manager to configure settings, manage repositories, or manage users.

You should be able to browse to http://localhost:8080 or https://localhost:8443 and login as admin/admin.

Stop the instance

You can shutdown your gitblit container with:

sudo docker exec -it gitblit

You can manually re-start your container with:

sudo docker start gitblit

Data persistence

The Gitblit image stores data under /var/opt/gitblit. A Docker volume is defined for this path, so that data is stored persistently and efficiently. The data is split into a subfolder for configuration data (etc/) and one for repository data (srv/).

User id

The gitblit server is run under the user and group id 8117, assigned to the user gitblit.

Build Instructions

You can build your own Gitblit image with the files in this repository.

Clone this Repository

git clone

Build your Docker container

cd gitblit-docker
sudo docker build -t my-gitblit .

Run your Gitblit container and setup localhost port-forwarding (-p localhost:container)

sudo docker run -d --name gitblit -p 8443:8443 -p 8080:8080 -p 9418:9418 -p 29418:29418 my-gitblit

Migrating from an older image

The directory layout for the Gitblit data was changed with the image for version 1.9.0. If you had previously used a Docker image of Gitblit with a volume mounted on /opt/gitblit-data, migration of the configuration data is advised. A script migrate-data is available in the new image for this. Run the script from a container with your volume mounted under /var/opt/gitblit.

$ ls -l
total 0
drwxr-xr-x  6 beowulf  staff       192 Mar 10 21:02 gitblit-data/

$ sudo docker run -it --rm -v $PWD/gitblit-data:/var/opt/gitblit my-gitblit migrate-data

Creating new directories 'etc' and 'srv' ...
Moving existing files to new directories ...
   Moving to folder 'etc': certs
   Moving to folder 'etc':
   Moving to folder 'srv': git
   Moving to folder 'etc':
   Moving to folder 'etc': gitignore
   Moving to folder 'etc': groovy
   Moving to folder 'srv': lfs
   Moving to folder 'etc': plugins
   Moving to folder 'etc': projects.conf
   Moving to folder 'etc': serverKeyStore.jks
   Moving to folder 'etc': serverTrustStore.jks
   Moving to folder 'etc': ssh-dsa-hostkey.pem
   Moving to folder 'etc': ssh-rsa-hostkey.pem
   Moving to folder 'etc': users.conf
Adjusting 'include' setting in etc/
Checking the file for changes.
   There were changes detected in the file.
   These have been copied over into the file.
   Please review these and adjust as required.
   The file should not be changed as it gets overwritten upon upgrade.

$ sudo docker run -d --name gitblit -v $PWD/gitblit-data:/var/opt/gitblit -p 8080:8080 my-gitblit