How to Install & Configure Git on Linux Mint 20

Git is a mature, actively maintained open source project initially developed in 2005 by Linus Torvalds, the famous Linux operating system kernel creator. Git is designed for developers that need a pretty straightforward version control system. Most software is collaborative efforts and sometimes can have hundreds of people with commits working on software development projects. It is essential to track these commits customarily done in branches in most projects before being merged into the master for release. It is easy to review and track down any incorrect commits and revert, leading to a much easier development if anything goes wrong.

In the following tutorial, you will learn how to install Git on Linux Mint with various methods.


Update Operating System

Update your Linux Mint operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@linuxmint ~]$ sudo whoami

To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Linux Mint.

To use the root account, use the following command with the root password to log in.


Install Git with APT Package Manager

Git is available in the default Linux Mint (Ubuntu) repository, installed using the APT package manager. To do this, use the following command:

sudo apt install git

Example of dependencies that will be installed:

How to Install & Configure Git on Linux Mint 20

Type Y, then press ENTER KEY to proceed with the installation.

Once installed, verify the installation:

git --version

Example output:

git version 2.25.1

Install Git from PPA

An alternative solution for users wanting a newer version while still using the APT package manager is to install the Git PPA as follows

In your terminal, execute the following command:

sudo apt install software-properties-common
sudo add-apt-repository ppa:git-core/ppa -y

Example output if successful:

How to Install & Configure Git on Linux Mint 20

Next, update your APT repository list to reflect the new PPA.

sudo apt update

Now, if you have already installed it, you should see a notification to upgrade the packages.

sudo apt upgrade

Alternatively, if you have not installed Git yet, use the following command to install Git.

sudo apt install git

Now, verify the version build of the Git version from the PPA.

git --version

Example output:

git version 2.33.1

The difference between the PPA and the default APT repository is significant, with default eating build 2.25.1 and the PPA with 2.33.1. The PPA is often recommended for using newer versions of GIT, which you can pull any future updates easily. However, having the absolute latest involves manually compiling Git from the source each time it updates.


Compile & Install Git from Source

The tutorial has covered how to install stable or unstable using the APT package manager. However, for those wanting the absolute latest Git version, it’s recommended to always install from the source.

As with unstable, you will need to make sure any security issues are monitored; with the source, you can quickly re-compile any urgent updates making this the better option for anyone needing to use the latest Git.

To begin with, install the Git dependencies as follows:

sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip

Example output:

How to Install & Configure Git on Linux Mint 20

Type Y, then press the ENTER KEY to proceed.

Once the dependencies are installed, visit the release page to find the master zip archive or the latest stable release from Git.

At the time of writing the guide, 3.3.1 is the latest stable release.

Use the wget command as below:


Use the wget command to get the latest development version (master):

wget -O

Note, do not use this version unless as it will be unstable and possibly contain bugs.

Next, Unzip which archive you downloaded:



Now you will need to navigate to the directory using the CD command:

cd git-2.33.1

You now need to run the following make commands to install git:

First command:

make prefix=/usr/local all

Second command:

sudo make prefix=/usr/local install

Now that you have installed Git from the source, verify the installation and build:

git --version

Example output:

git version 2.33.1

How to Configure Git

After installation, you will need to set up standard settings such as names and e-mails, mainly around git commit messages. This is pretty straight forward as the tutorial will explain below.

The first step is to provide your name that will be set Globally:

git config --global "YOUR NAME"

Next, select your e-mail; this can fake if you prefer:

git config --global "YOUR EMAIL"

To confirm these have been added, use the config –list command:

git config --list

Example below:

How to Install & Configure Git on Linux Mint 20

Unless specified, Git stores details in the ~/.gitconfig file. You can review what is currently stored by using the cat command:

cat ~/.gitconfig

Example below:

How to Install & Configure Git on Linux Mint 20

Note, using the sudo command with the git config command will set two separate user names and e-mails.

You can store this information for quicker access in the future; note this is for dedicated servers being run by 1 or 2 people that are trustworthy as the information isn’t stored securely or encrypted and is just in text form, so any users that have access to the server can easily read this.

git config --global credential.helper cache

If you must use credential helper, it is advised to cache only for a limited time for increased security. For example, you will be working today using Git for 1 to 4 hours but won’t be touching it for maybe a few weeks, then set expiry for 5 hours:

git config --global credential.helper "cache --timeout=18000"

After 5 hours, the credentials will be deleted. This secures your GIT.


Comments and Conclusion

Git is a fantastic piece of software for software developers and sysadmins. Web server owners can track changes on specific directories when developing your servers or website, and the ability to quickly revert should not be looked over. Git is not the most accessible software to work. However, it works well for what it is designed for.

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x