How to Install/Upgrade 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. Tracking these commits customarily done in branches in most projects is essential before merging 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.

The following tutorial will teach how to install Git on Linux Mint 20 LTS release series desktop or headless server using the command line terminal and basic Git commands of everyday use.

Update Linux Mint

First, update your system to ensure all existing packages are up-to-date to avoid conflicts with the following command.

sudo apt update && sudo apt upgrade -y

Install Git – APT Default Method

Git is available on the default repository used by Linux Mint. To install this version use the following command.

sudo apt install git -y

Once installed, verify the installation.

git --version

Install Git – APT LaunchPad PPA Method

An alternative installation method is to use the custom PPA GIT Core maintained by the Ubuntu Git Mainters team for the latest stable version. Users that have Git installed already can import this and run the installation command or upgrade command to update their version.

First, import the PPA.

sudo add-apt-repository ppa:git-core/ppa -y

Remember, this PPA has the most up-to-date packages for GIT, so you should always be up-to-date with the latest versions of GIT when they hit the git-core PPA.

Next, run an APT update to sync the new addition.

sudo apt update

For users that have Git installed and users that do not, I would recommend using the installation command for both.

sudo apt install git -y

Once installed, verify the installation.

git --version

Install Git – Manual Method

For those that want the absolute latest Git version, it is 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.

Begin with installing the Git build dependencies with the following command.

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

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

Use the wget command to download the archive as below.


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

wget -O

Note, do not use this version unless it will be unstable and possibly contain bugs, and you will need to update it more often.

Next, Unzip which archive you downloaded.


sudo unzip {version}

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

cd git-{version}

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

First command:

sudo make prefix=/usr/local all

Second command:

sudo make prefix=/usr/local install

Verify the installation and build once you have installed Git from the source.

git -version

Git Configuration & Setup

The following parts will cover some typical setups and commands used daily by users of GIT.

GIT Add user

After installation, you must set up standard settings such as names and e-mails, mainly around git commit messages. This is pretty straightforward, 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 be fake if you prefer.

git config --global "YOUR EMAIL"

GIT Create Directory

First, create the directory for users who want to make a new directory strictly for GIT.

mkdir example-directory -p

Next, navigate to the directory.

cd example-directory -p

The next task is to use the initialization command, creating a hidden .git directory to store the configuration, history, and so on.

git init

You will see a terminal output stating the status of the directory being initialized, and you can additionally see the content using the following command.

ls -a .git

Print GIT CONFIG Details

To confirm GIT config users and details, use the config –list command

git config --list

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

cat ~/.gitconfig

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

Store GIT Credentials

For users who want to keep authorization details stored, you can enable the credential helper cache using the following.

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, if you will be working today using GIT for 1 to 4 hours but will not touch Git for maybe a few weeks, then set the expiry for 5 hours for best security practices.

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

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

Check Directory GIT Status

To view the status of a GIT repository, you can use the following git status command.

git status

While the above command helps with giving a status of the GIT, you can additionally list all git commands and sub.

Connect Remote GIT Repository

Users that need to work with GIT remotes to sync and download/upload changes, you will need to link the GIT. This can be done using the git remote command as follows.

git remote add origin remote-repository-link

Commit GIT Changes

When you have completed changes in your GIT directory and want to SYNC it to push to the remote repository, use the following git commit command.

git commit -m "git message changelog"

Note the -m “git message change” is the message that appears in the changelog.

Push GIT Changes

To push or send changes to the remote repository to SYNC in both versions, use the following git push command.

git push origin master

Pull GIT Changes

Alternatively, to pull or get changes from the remote repository to SYNC in both versions, use the following git push command.

git pull origin master

How to Update/Upgrade Git

For updates to GIT, they will be included with your standard system packages as you installed git-core with the APT package manager. Use the following command to update and upgrade.

sudo apt update && sudo apt upgrade

How to Remove (Uninstall) Git

For users that no longer want GIT installed, use the following command to remove the software.

sudo apt autoremove git -y

Users that installed Git from the PPA use the following command to remove it.

sudo add-apt-repository --remove ppa:git-core/ppa -y

The manual method is removal with the directory.

Comments and Conclusion

If you are a web server administrator, learning to use GIT is what you should do. It can make your job a lot easier and help speed up the development process. While Git may be challenging to learn at first, it is well worth the investment.


Like to get automatic updates? Follow us on one of our social media accounts!