Gitblit
Overview
Gitblit is an open-source, pure-Java Git server. It hosts repositories over HTTP, HTTPS, SSH and the git protocol, and it provides a web interface for browsing commits, branches and files. An admin panel with its own flat-file user and permission model means there is no external database to run.
This SecureAnyCloud image installs Gitblit 1.10.0 on OpenJDK 17 and runs it as a dedicated gitblit system user. Gitblit binds to loopback, and an nginx reverse proxy terminates TLS in front of it.
What you get:
- Gitblit 1.10.0 Git server on OpenJDK 17 at
/opt/gitblit, with data at/var/lib/gitblit - An nginx reverse proxy that terminates a per-VM self-signed TLS certificate on
:443, in front of Gitblit on loopback:8080 - Git over HTTPS (
:443) and Git over SSH (Gitblit's built-in daemon on:29418) - Authenticated-only access by default: every repository requires a sign-in to view, clone or push
- A per-VM admin password (
GITBLIT_ADMIN_PASSWORD) generated on first boot and stored in a root-only file, with the stockadmin/admindefault removed - A per-VM TLS certificate and a per-VM Gitblit SSH host key, both generated on first boot
gitblit.serviceandnginx.serviceas enabled, active systemd units- 24/7 SecureAnyCloud support
Prerequisites
You need an active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region.
Standard_B2s (2 vCPU / 4 GiB RAM) is a solid starting size. Scale up for many concurrent users or large repositories.
Configure the network security group (NSG) to allow inbound 22/tcp from your management network and 443/tcp for the web interface and Git over HTTPS. If you use Git over SSH, also allow 29418/tcp. Open each port only to the networks that need it.
Step 1 - Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Gitblit by SecureAnyCloud, and select Create.
On the Basics tab, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTPS (443).
Select Review + create, then Create.
Step 2 - Deploy from the Azure CLI
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:gitblit-ubuntu-24-04:default:latest
az vm create \
--resource-group <your-rg> \
--name gitblit \
--image sac1647283583153:gitblit-ubuntu-24-04:default:latest \
--size Standard_B2s \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name gitblit --port 443 --priority 1010Step 3 - Connect to your VM
Connect to the VM over SSH:
ssh azureuser@<vm-public-ip>Step 4 - Confirm the services are running
Check that both services are active:
systemctl is-active gitblit.service nginx.serviceBoth services report active. On first boot, Gitblit can take up to a minute to start fully while the JVM warms up and generates the per-VM SSH host key.
Step 5 - Retrieve your admin password
The admin password is generated uniquely on the first boot of your VM and written to a root-only file. The stock admin/admin default is removed at build time and never ships.
Read the file as root:
sudo cat /root/gitblit-credentials.txtThe GITBLIT_ADMIN_PASSWORD value is the password. Use it to sign in to the web interface as admin.
Step 6 - Sign in to the web interface
Browse to https://<vm-public-ip>/ and sign in as admin with the password from Step 5.
The certificate is self-signed and unique to this VM, so your browser shows a one-time warning. Accept it, or install a CA-signed certificate (see Using your own TLS certificate below). Because the appliance is authenticated-only, an unauthenticated visitor sees only the sign-in prompt.
After you sign in, you land on your dashboard, which lists your repositories and recent activity.
Step 7 - Create your first repository
Select repositories > create repository, enter a name (for example myrepo), and save.
Alternatively, Gitblit creates a repository automatically the first time an admin pushes to a new URL (see Step 8). Once a repository has content, you can browse its commit history, branches and files in the web interface.
Step 8 - Clone and push over HTTPS
From your workstation, clone over HTTPS and authenticate as admin. The certificate is self-signed, so either install it as trusted or set GIT_SSL_NO_VERIFY=true for that clone:
git -c http.sslVerify=false clone https://admin@<vm-public-ip>/r/myrepo.gitTo verify the full round trip on the VM itself, push to a new URL (Gitblit creates the repository on first push) and clone it back:
PW=$(sudo grep '^GITBLIT_ADMIN_PASSWORD=' /root/gitblit-credentials.txt | cut -d= -f2-) REPO="guide-demo-$(date -u +%s)"
WK=$(mktemp -d); cd "$WK" git -c init.defaultBranch=master init -q app && cd app printf '# %s\n' "$REPO" > README.md git -c user.email=you@example.com -c user.name=you add README.md git -c user.email=you@example.com -c user.name=you commit -qm "Initial commit" git -c http.sslVerify=false push "https://admin:$PW@127.0.0.1/r/${REPO}.git" master cd "$WK" git -c http.sslVerify=false clone -q "https://admin:$PW@127.0.0.1/r/${REPO}.git" verify grep -q "$REPO" verify/README.md && echo "ROUND_TRIP_OK: pushed commit is present after re-clone"Step 9 - Use Git over SSH (optional)
Gitblit runs its own SSH daemon on :29418. In the web interface, open your profile, select edit and then add SSH key, and paste your public key.
Then clone with the SSH URL shown on each repository's summary page:
git clone ssh://admin@<vm-public-ip>:29418/myrepo.gitThe SSH host key is unique to your VM and generated on first boot. Your first connection therefore prints a normal host-key confirmation.
Access model and opt-in to public read
The appliance ships authenticated-only. The setting git.defaultAccessRestriction = VIEW means every repository requires a sign-in to view, clone or push. The setting web.authenticateViewPages = true means the web interface shows nothing to anonymous visitors.
To allow anonymous (public) read access, edit /var/lib/gitblit/gitblit.properties and change the global default. You can also set it per repository in the web interface's repository settings. Then restart Gitblit:
# Allow anonymous clone/read globally (opt-in):
git.defaultAccessRestriction = PUSH web.authenticateViewPages = falseManage users, teams and per-repository permissions from the users page and from each repository's edit > permissions panel.
Using your own TLS certificate
The image generates a per-VM self-signed certificate at /etc/ssl/gitblit/. For production, point a domain at the VM and install a CA-signed certificate.
The example below uses certbot. Replace the domain with your own, then reload nginx:
sudo apt-get update && sudo apt-get install -y certbot
sudo certbot certonly --standalone -d your-domain.example.com
sudo sed -i 's#/etc/ssl/gitblit/gitblit.crt#/etc/letsencrypt/live/your-domain.example.com/fullchain.pem#; s#/etc/ssl/gitblit/gitblit.key#/etc/letsencrypt/live/your-domain.example.com/privkey.pem#' /etc/nginx/sites-available/sac-gitblit-ssl
sudo systemctl reload nginxBackup and maintenance
All repositories, configuration and the flat-file user database live under /var/lib/gitblit. To back them up, snapshot the OS disk in Azure.
Keep the OS patched with sudo apt update && sudo apt upgrade. Restart Gitblit with sudo systemctl restart gitblit. Its configuration is in /var/lib/gitblit/gitblit.properties.
Support
This image comes with 24/7 SecureAnyCloud support. Contact us by email or chat for help with repository hosting, user and permission management, Git over SSH, TLS and backups.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. Git is a trademark of the Software Freedom Conservancy.
Deploy on Azure
Launch Gitblit on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com