The method of creating git warehouse with gitblit tool in Linux system

Time:2021-7-22

Hi! Friends, today we will learn how to install gitblit on your Linux server or PC. First, let’s look at what Git is, its functions and the steps to install gitblit. Git is a distributed version control system, which emphasizes speed and data consistency, and supports distributed and nonlinear workflow. It was originally designed and developed by Linus Torvalds for Linux kernel in 2005, using gplv2 certificate, and has become the most widely used version control system in software development ever since.

Gitblit is completely open source software, which is based on pure Java stack. It is designed to be competent for small to very large projects in terms of speed and efficiency of GIT warehouse. It’s easy to learn and learn, and has lightning performance. It is far superior to SCM tools such as subversion, CVs, perforce and ClearCase in many aspects, such as fast local branching, easy staging, multi workflow, etc.
2015729162325381.png (735×255)

Functions of gitblit

    It can be used as a dummy warehouse view without management control and user accounts.
    It can be used as a complete git service with clone, push and warehouse access control.
    It can be used independently of other git tools (including the actual GIT), and it can work with your existing tools.

1. Create gitblit installation directory

First, we will set up a directory on our server and install the latest gitblit in that directory.

   

Copy code

The code is as follows:

$ sudo mkdir -p /opt/gitblit
$ cd /opt/gitblit

2015729162353959.png (359×51)

2. Download and unzip

Now, we will download the latest version of gitblit from gitblit’s official website. Here we will install version 1.6.2. Therefore, please modify the command according to the specific version during installation.

   

Copy code

The code is as follows:

$ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz

2015729162411028.png (671×470)

Next, we unzip the downloaded tar package to the previously created directory / opt / gitblit/

   

Copy code

The code is as follows:

$ sudo tar -zxvf gitblit-1.6.2.tar.gz

    2015729162504127.png (671×470)

3. Configure and run

Now, we’ll configure gitblit. If you want to customize gitblit’s behavior, you can modify gitblit / data / gitblit.properties. After the configuration is complete, we will run the installed gitblit. There are two ways to run gitblit. The first is to run gitblit manually through the following command:

   

Copy code

The code is as follows:

$ sudo java -jar gitblit.jar –baseFolder data

The other is to add gitblit as a service. Here are the steps to add gitblit as a service under Linux.

Since I am using Ubuntu, the following command will be sudo CP service-ubuntu.sh / etc / init.d/gitblit, so please modify the file name service-ubuntu.sh according to your distribution to the corresponding distribution you are running.

   

Copy code

The code is as follows:

$ sudo ./install-service-ubuntu.sh
$ sudo service gitblit start

2015729162536571.png (623×300)

    Open in your browser http://localhost:8080 or https://localhost:8443 You can also replace the localhost with an IP address according to the local configuration. Enter the default administrator credentials: admin / Admin and click the login button.
  2015729163202998.png (999×582)

Now, we will add a new user. First of all, you need to log in as admin user, user name = admin, password = admin.

Then, click the user icon > users > +) new user to create a new user, as shown in the figure below.
2015729163221551.png (999×661)

Now, we will create a warehouse that can be used out of the box. Click repositories > () new repository. Then, add a new warehouse as shown in the figure below.
2015729163241841.png (997×647)

Use the command line to create a new warehouse

       

Copy code

The code is as follows:

touch README.md
git init
git add README.md
git commit -m “first commit”
git remote add origin ssh://[email protected]:29418/linoxide.com.git
git push -u origin master

Please replace the user name arunlinoxide with the one you added.
Push an existing repository on the command line

       

Copy code

The code is as follows:

git remote add origin ssh://[email protected]:29418/linoxide.com.git
git push -u origin master

Note: it is strongly recommended that everyone change the password of the user name “admin”.
conclusion

Cheers! We have installed the latest version of gitblit on our Linux computer. Next, we can enjoy such a beautiful version control system in our projects. With gitblit, version control can’t be easier. It is easy to learn, lightweight and high performance.