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.
[root@goddard ~]# 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:
[root@goddard ~]# cd /opt/
[root@goddard opt]# wget -q http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.tar.gz
[root@goddard 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
[root@goddard opt]# tar -zxf gitblit-1.7.1.tar.gz
[root@goddard 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:
[root@goddard opt]# mv gitblit-1.7.1 gitblit
[root@goddard 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:
[root@goddard opt]# cd gitblit
[root@goddard 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:
[root@goddard gitblit]# /etc/init.d/gitblit start
Starting gitblit (via systemctl): [ OK ]
[root@goddard 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
[root@goddard git]# pwd
/opt/gitblit/data/git
[root@goddard 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