Docker image containing a Git server accessible via SSH.
Image source at: https://github.com/sanrep/docker-gitserver.
Git server configuration allows use cases which are detailed in the source README:
For quick setup (not recommended for production) create directory for git repositories and run:
docker run -d \
-v /git/repositories/dir:/srv/git \
-p 2222:22 \
sanrep/gitserver
Default password for git user is 12345.
Advanced setup on host:
GIT_PASSWORD environment variable with the password for git user in .env file (if not set, for testing, default is 12345)authorized_keys file, and set it's permissions to 600authorized_keys (see source README)Then run git server container:
docker run -d \
-v /git/repositories/dir:/srv/git \
-v /authorized/keys/dir/authorized_keys:/home/git/.ssh/authorized_keys \
-v /ssh/host/keys/dir:/ssh_host_keys:ro \
--env-file .env
-p 2222:22 \
sanrep/gitserver
Or create .env file and use docker-compose.yml from source:
cp .env.sample .env
vim .env
docker compose up -d
Log into git server through SSH:
ssh [email protected] -p 2222
Replace gitserverhost.com with DNS name (or IP address) of the host where git server is deployed.
Create and initialize bare git repository (.git suffix is not needed):
new your-repo
To clone repository from git server:
git clone ssh://[email protected]:2222/srv/git/your-repo.git
You can set shorter URLs as described in source. Then you can login into server:
ssh my_git_server
To clone repository:
git clone my_git_server:git/your-repo.git
See Variants and Tagging Scheme.
View license information for the software contained in this image.
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
This docker image is based on excellent rockstorm's git-server-docker.
Customizations include:
.env filelist and new)main as initial branchContent type
Image
Digest
sha256:9866c18ed…
Size
10.2 MB
Last updated
about 3 years ago
docker pull sanrep/gitserver