Over a million developers have joined DZone.

Install Git on Ubuntu 18.04 from Source

DZone's Guide to

Install Git on Ubuntu 18.04 from Source

Check out this tutorial that gives you the basic step-by-step of installing and uploading the latest version of Git from the source.

· Open Source Zone ·
Free Resource

DON’T STRESS! Assess your OSS. Get your free code scanner from FlexeraFlexNet Code Aware scans Java, NuGet, and NPM packages.

In this post, I will walk you though how to install Git on Ubuntu 18.04 from source so that you can have the latest and greatest version of git.

Before We Begin

Make sure that your system is fully updated:

# apt update && apt upgrade -y

Restart and install the prerequisite packages.

# apt install build-essential dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev

Download the Source Tarball.

First, go to the Git Releases page on Github. Find the latest release. At the time of the writing, this is 2.17.1 so if the latest has changed be sure to adjust the commands below. Click on the release then on the (tar.gz) file to download. Or you can get the link and use wget if you need to download to a remote server.

# wget https://github.com/git/git/archive/v2.17.1.tar.gz

Extract the tarball.

# tar -xzvf v2.17.1.tar.gz

This will create a git-2.17.1/ directory. Change to this directory.

# cd git-2.17.1/

Install Git on Ubuntu 18.04

Make the configuration file.

# make configure

Run the configuration

# ./configure --prefix=/usr

Build the source code

# make all

If you want to build everything then use this command:

# make all doc info

Once it is complete install the binaries:

# make install

or if you built everything then use this command:

# make install install-doc install-html install-info

Check and make sure that it works.

# git --version
git version 2.17.1

Congratulations, you now have the latest and greatest version of git installed! You can remove the directory now.

Updating Git

Now that you have installed Git from source code you have an easy way to update it. Simply clone git

# git clone git://git.kernel.org/pub/scm/git/git.git

Check out the release you want to upgrade to.

# git checkout v1.whatever

And go through the build process again.

Click here for more great articles on Ubuntu from AdminTome Blog.


I hope you have enjoyed this article, if so please leave a comment below. For more articles, please signup for the AdminTome Blog below. Also please feel free to share the article to your friends using the buttons to the left. Thanks again for reading this post.

Try FlexNet Code Aware Today! A free scan tool for developers. Scan Java, NuGet, and NPM packages for open source security and license compliance issues.

open source ,git ,ubuntu ,installation ,update

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}