How to Install Gitblit on Void Linux
Gitblit is a web-based Git repository manager. It provides an easy-to-use interface to manage your Git repositories, users, access control, and more. In this tutorial, we will learn how to install Gitblit on Void Linux.
Step 1: Install Java
Gitblit requires Java to run. You can install OpenJDK from the Void Linux repository.
sudo xbps-install -S openjdk
Step 2: Download Gitblit
You can download Gitblit from the official website:
wget https://github.com/gitblit/gitblit/releases/download/v1.9.0/gitblit-1.9.0.tar.gz
Step 3: Extract Gitblit
Extract the downloaded Gitblit tarball to /opt directory.
sudo tar -zxvf gitblit-1.9.0.tar.gz -C /opt
Step 4: Create Gitblit systemd Service
Create a new systemd service unit for Gitblit.
sudo nano /etc/systemd/system/gitblit.service
Paste the following contents into the file.
[Unit]
Description=Gitblit - a pure Java stack for managing, viewing, and serving Git repositories
Documentation=https://gitblit.com/
After=network.target
[Service]
WorkingDirectory=/opt/gitblit
ExecStart=/usr/bin/java -Djetty.git.gitHome=/opt/git -jar gitblit.jar
SyslogIdentifier=gitblit
User=gitblit
Type=simple
Restart=always
TimeoutSec=30
[Install]
WantedBy=multi-user.target
Save and close the file.
Step 5: Create a Gitblit User
Create a system user and group for Gitblit.
sudo useradd -r -s /bin/false gitblit
Step 6: Set Permissions
Set the Gitblit files' ownership and permissions.
sudo chown -R gitblit:gitblit /opt/gitblit
sudo chmod -R 755 /opt/gitblit
Step 7: Reload Systemd and Start Gitblit
Reload systemd and start the Gitblit service.
sudo systemctl daemon-reload
sudo systemctl start gitblit
Step 8: Verify Gitblit
You can verify Gitblit's running status and access the web interface by visiting the following URL in your browser.
http://localhost:8080
Congratulations! You have successfully installed Gitblit on Void Linux.