Simple docker setup for ungit
- https://github.com/FredrikNoren/ungit
Github: https://github.com/miebach/ungit-docker
-
You should most propbably set a password in the .ungitrc file
-
Maybe set the interface to localhost only, see .ungitrc
-
Consider https by putting it behind a reverse proxy
-
In both setups the current user's ./.ssh/ directory is mounted into the container, but this also contains the private keys. This could be improved.
When connecting to git remotes for the first time, keep an eye on the terminal, there might be certificate questions to answer. This is still unsolved for the docker-compose setup. A workaround is to use git on the command line once, after that ungit should not complain anymore.
Copy dot-env-example to .env and set LOCALREPOBASE to your base folder for local repositories. See explanation below.
docker compose up
Then go to http://127.0.0.1:8448 or use the public IP of your docker host.
You can create a start script similar to this:
#!/bin/bash
LOCALREPOBASE=$HOME/myprojects # set to your base folder for local repositories
docker run -it --rm \
-p 8448:8448 \
-v $HOME/.ungitrc:/home/node/.ungitrc \
-v $HOME/.ssh:/home/node/.ssh \
-v $HOME/.gitconfig:/home/node/.gitconfig \
-v $LOCALREPOBASE:/data \
miebach/ungit
A .ungitrc
configuration could look like this, remember to replace the password:
{
"port": 8448,
"bugtracking": false,
"autoFetch": false,
"ungitBindIp": "0.0.0.0",
"launchBrowser": false,
"authentication": true,
"users": {
"admin": "replace-password-here"
}
}
If you don"t want to provide a .ungitrc
you can omit the -V line and a .ungitrc
from the container will be used,
but it allows access without login if that is what you want.
Adjust all variables before running ungit
To construct a path for ungit, you need to replace your local repository base directory from above with /data/
in the ungit gui in your browser. Example:
If you want to open your local repository /home/myaccount/myprojects/project1
you set $LOCALREPOBASE
to /home/myaccount/myprojects
you need to enter /data/project1
in the ungit gui in your browser.
You can set your user data globally, the global git configuration is visible to the container.
Started as a fork of https://github.com/mcrmonkey/ungit See also https://github.com/lsascha/ungit