How to Install Qgit Viewer in Ubuntu

Git is a useful tool for developers, as it makes it very easy to control versions of software, issue patches, and contribute upstream. Though, for as helpful as Git is,  a lot of interaction with Git is done with the command line, and it is tedious.

For those that love to use Git but don’t want to deal with the command line on Linux, there is Qgit Viewer – a Qt-based Git-viewing tool for Linux. With it, users can access Git repos to contribute code, patches and everything that the command line version of Git can do!

Let’s discuss how to install it.

Related: 6 Useful Graphical Git Clients for Linux

Various Qt4 libraries and components are needed before the program builds. The program will not build correctly without these tools. The developer has failed to really list the exact components the user needs (in extreme detail). It is because of this that the best course of action is to use a wildcard in the terminal and use it to install everything Qt4 related.

sudo apt install qt4* git

When the command completes, Qgit Viewer will be able to compile correctly. Get the source code for Qgit Viewer.

qgit-viewer-sourceforge-download-page

Extract the source code. Open a terminal and enter the source code directory.

cd qgit

First, run the qmake command. This command will create the makefile. A makefile is key in the compiling process.

qmake

qgit-viewer-make-file

Qmake has created a Makefile. Run the make command to start the compilation of Qgit Viewer.

make

Finally, to finish the compilation process, run the make command again but with the install command to finish the compiling process.

make install

qgit-viewer-compiled-program

After the qmake, make and make install commands have run through, a new folder in the “qmake” directory will appear labeled “bin.” This folder contains the fully compiled Linux binary for use on Ubuntu.

To run Qgit Viewer, double-click on it (or right-click, then execute). The compiler should automatically set the correct permissions to allow the binary to run and execute as a program, so there’s no need to fiddle with it.

Another way (and perhaps the best way) to run Qgit the first time is to run it from the terminal window itself. This is because the Linux terminal can output any errors directly, let the user know of missing dependencies, etc. To run Qgit from the terminal, enter the following:

cd ~/Downloads/qgit/bin/
./qgit

qgit-viewer-running-qgit-viewer

Creating a desktop icon for Qgit Viewer will help the program open more easily. To start, enter the Qgit bin directory with the terminal.

cd ~/Downloads/qgit/bin

Move the binary file to the /usr/bin/ directory.

sudo mv qgit /usr/bin

qgit-viewer-desktop-icon

The Qgit binary is in the right place. Now, let’s make the desktop icon. Open Gedit and paste the following into it.

[Desktop Entry]
Name=Qgit Viewer
Comment=A git GUI viewer built on Qt/C++.
Exec=/usr/bin/qgit
Terminal=false
Type=Application
Categories=Accessories;

Save the file as “qgit-viewer.desktop.” Then, locate the saved desktop file. Right-click the file, select “Properties,” then the permissions tab. Check the box “allow executing file as a program,” and close the window.

Place the desktop file in the application directory with:

sudo mv qgit-viewer.desktop /usr/share/applications

With the Desktop icon made and everything taken care of, Qgit Viewer is installed on the Ubuntu desktop. From here, code patches, code contributions, and everything in-between can now be done with a nice GUI tool. So long as Git is configured on the system, everything should run smoothly!

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.