If you are a programmer or work with programmers, managing code repositories is one the task you’ll likely to encounter. Git has become widely popular for storing/managing code repositories.
Gitblit GO is an open-source, pure Java stack for managing, viewing, and serving Git repositories. It’s designed primarily as a tool for workgroups who want to host centralized repositories. Gitblit GO is an integrated, single-stack solution based on Jetty.
In this fast tutorial, you’ll be able to install GitBlit Go and create you own git repositories.
Install pre-requisite packages
First be sure that you have installed all packages necessary to run and use Gitblit. On my server, the packages are already installed so I can now proceed further.
[[email protected] ~]# yum -y install git httpd perl java wget
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Package git-1.8.3.1-6.el7_2.1.x86_64 already installed and latest version
Package httpd-2.4.6-40.el7.x86_64 already installed and latest version
Package 4:perl-5.16.3-286.el7.x86_64 already installed and latest version
Package 1:java-1.8.0-openjdk-1.8.0.77-0.b03.el7_2.x86_64 already installed and latest version
Package wget-1.14-10.el7_0.1.x86_64 already installed and latest version
Nothing to do
Download the Gitblit Package
Now you need to download the Gitblit Go package files. Go the www.gitblit.com website and click the “Download Gitblit Go (Linux). Upload the file to your CentOS server on the /opt folder and be ready to extract it.
You can also directly download the Gitblit Go package file from the command-line using wget:
[[email protected] ~]# cd /opt/
[[email protected] opt]# wget -q http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.tar.gz
[[email protected] opt]# ls -l
total 40668
-rw-r--r-- 1 root root 41640702 Nov 23 23:16 gitblit-1.7.1.tar.gz
Extract the Package
Extract the file using tar, and you should see the gitblit folder
[[email protected] opt]# tar -zxf gitblit-1.7.1.tar.gz
[[email protected] opt]# ls -l
total 40672
drwxr-xr-x 5 root root 4096 Nov 23 22:16 gitblit-1.7.1
-rw-r--r-- 1 root root 41640702 Nov 23 23:16 gitblit-1.7.1.tar.gz
Rename the gitblit folder:
[[email protected] opt]# mv gitblit-1.7.1 gitblit
[[email protected] opt]# ls -l
total 40672
drwxr-xr-x 5 root root 4096 Nov 23 22:16 gitblit
-rw-r--r-- 1 root root 41640702 Nov 23 23:16 gitblit-1.7.1.tar.gz
Copy the startup script
Go inside the gitblit folder and copy the init script need to start/stop the gitblit service:
[[email protected] opt]# cd gitblit
[roo[email protected] gitblit]# cp -pv service-centos.sh /etc/init.d/gitblit
‘service-centos.sh’ -> ‘/etc/init.d/gitblit’
Start the Gitblit Service
Now you can start the Gitblit service and check that the git service is running:
[[email protected] gitblit]# /etc/init.d/gitblit start
Starting gitblit (via systemctl): [ OK ]
[[email protected] gitblit]# ps -ef | grep git
root 3080 1 34 15:11 ? 00:00:11 java -server -Xmx1024M -Djava.awt.headless=true -jar /opt/gitblit/gitblit.jar --httpsPort 8443 --httpPort 0 --baseFolder /opt/gitblit/data --dailyLogFile
root 3153 2114 0 15:12 pts/1 00:00:00 grep --color=auto git
Access the WebGUI from the web browser
You can now access the Gitblit web interface via https port 8443 of you server. Open a web browser on your computer and type the IP address of the Gitblit server with the port number: https://192.168.10.10:8443. The default username/password is admin:admin.
From the web interface you can create user and manage git repositories. The git repositories by default are saved on the
/opt/gitblit/data/git folder
[[email protected] git]# pwd
/opt/gitblit/data/git
[[email protected] git]# ls -l
total 4
-rw-r--r-- 1 root root 451 Nov 23 22:16 project.mkd
Since everything will be save on this folder, you can setup your backup routines to backup the git repositories folder on regular intervals.
Sample git clone command:
git clone [email protected]:29418/test.git
————————————-
– masterkenneth