- Docker (>= 1.10.3)
- docker-compose (>= 1.6.2)
After installing the requirements, run inside this directory:
docker-compose up
During the first run, the nginx
container webserver
will complain that no certificates are available and will quit. (But gitserver
will keep running.)
To solve that, open a terminal and execute (replace (gitserver)
with the name of the container as printed by docker-compose up
call):
docker exec -it (gitserver) bash
This will connect you to the running gitserver
container and will launch an instance of bash inside it. Then enter (replace again (hostname)
here with your domain name):
cd /data/gogs/conf/
/app/gogs/gogs cert -ca=true -duration=8760h0m0s -host=(hostname)
exit
That's it. You now have self-signed certificates by gogs
. You can now restart the failed container:
docker-compose up
If you already have signed certificates, just copy them into: /var/gogs/gogs/conf
in your local system. They will automatically mounted during when docker-compose
is launched.
Remember to rename the certificate: cert.pem
, and the server key: key.pem
.
You can now acces you self-hosted gogs
service through HTTPS using any browser. You'll get a warning however as the certificate are self-signed.
To use git
with a self-signed, you need to disable SSL verification temporarly:
export GIT_SSL_NO_VERIFY=true
or permanently (:warning: DANGEROUS 🚷):
git config --global http.sslverify false
To use git
with ssh
on a different port than the default port 22:
git clone ssh://git@hostname:10022/user/repo.git
Remember to add your ssh
keys first!