Select Page

An previous edition of this educational was once written via Brennen Bearnes.


Model regulate methods are an increasing number of indispensable in fashionable instrument building as versioning lets you stay observe of your instrument on the supply degree. You’ll observe adjustments, revert to earlier phases, and department to create trade variations of recordsdata and directories.

One of the common edition regulate methods lately to be had is Git. Many initiatives’ recordsdata are maintained in a Git repository, and websites like GitHub, GitLab, and Bitbucket assist to facilitate instrument building mission sharing and collaboration.

On this information, we can exhibit the best way to set up and configure Git on an Ubuntu 18.04 server. We will be able to duvet the best way to set up the instrument in two other ways, every of that have their very own advantages relying to your particular wishes.

Must haves

To be able to whole this educational, you will have a non-root person with sudo privileges on an Ubuntu 18.04 server. To learn to do so setup, apply our manual initial server setup guide or run our automated script.

Together with your server and person arrange, you’re ready to start out.

Putting in Git with Default Programs

Ubuntu’s default repositories give you a quick option to set up Git. Word that the edition you put in by the use of those repositories could also be older than the most recent edition lately to be had. If you want the most recent free up, believe shifting to the next section of this educational to learn to set up and collect Git from supply.

First, use the apt bundle control equipment to replace your native bundle index. With the replace whole, you’ll be able to obtain and set up Git:

  • sudo apt replace
  • sudo apt set up git

You’ll ascertain that you’ve put in Git appropriately via operating the next command:


git edition 2.17.1

With Git effectively put in, you’ll be able to now transfer directly to the Setting Up Git phase of this educational to finish your setup.

Putting in Git from Supply

A extra versatile way of putting in Git is to collect the instrument from supply. This takes longer and may not be maintained via your bundle supervisor, however it’s going to mean you can obtain the most recent free up and provides you with some regulate over the choices you come with if you want to customise.

Earlier than you start, you want to put in the instrument that Git depends upon. That is all to be had within the default repositories, so we will be able to replace our native bundle index after which set up the applications.

  • sudo apt replace
  • sudo apt set up make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip

Once you have put in the vital dependencies, you’ll be able to pass forward and get the edition of Git you wish to have via visiting the Git project’s mirror on GitHub, to be had by the use of the next URL:

From right here, make sure that you’re at the grasp department. Click on at the Tags hyperlink and choose your required Git edition. Until you have got a reason why for downloading a free up candidate (marked as rc) edition, attempt to steer clear of those as they could also be risky.

git change branch select tags

Subsequent, at the appropriate facet of the web page, click on at the Clone or obtain button, then right-click on Obtain ZIP and replica the hyperlink cope with that results in .zip.

right-click on download zip to copy url

Again to your Ubuntu 16.04 server, transfer into the tmp listing to obtain transient recordsdata.

From there, you’ll be able to use the wget command to put in the copied zip document hyperlink. We’ll specify a brand new title for the document:

  • wget -O

Unzip the document that you simply downloaded and transfer into the ensuing listing via typing:

Now, you’ll be able to make the bundle and set up it via typing those two instructions:

  • make prefix=/usr/native all
  • sudo make prefix=/usr/native set up

To be sure that the set up was once a hit, you’ll be able to sort git --version and also you must obtain related output that specifies the present put in edition of Git.

Now that you’ve Git put in, if you wish to improve to a later edition, you’ll be able to clone the repository, after which construct and set up. To seek out the URL to make use of for the clone operation, navigate to the department or tag that you wish to have at the project’s GitHub page after which replica the clone URL at the appropriate facet:

git copy URL

On the time of writing, the related URL is:

Alternate to your house listing, and use git clone at the URL you simply copied:

  • cd ~
  • git clone

This may increasingly create a brand new listing inside your present listing the place you’ll be able to rebuild the bundle and reinstall the more recent edition, identical to you probably did above. This may increasingly overwrite your older edition with the brand new edition:

  • cd git
  • make prefix=/usr/native all
  • sudo make prefix=/usr/native set up

With this whole, you’ll be able to make sure that your edition of Git is up to the moment.

Environment Up Git

Now that you’ve Git put in, you must configure it in order that the generated dedicate messages will include your proper data.

This can also be accomplished via the use of the git config command. In particular, we wish to supply our title and electronic mail cope with as a result of Git embeds this knowledge into every dedicate we do. We will be able to pass forward and upload this knowledge via typing:

  • git config --global person.title "Your Title"
  • git config --global person.electronic mail ""

We will be able to see the entire configuration pieces which have been set via typing:


person.title=Your Title person.electronic ...

The guidelines you input is saved for your Git configuration document, which you’ll be able to optionally edit via hand with a textual content editor like this:

~/.gitconfig contents

  title = Your Title
  electronic mail =

There are lots of different choices that you’ll be able to set, however those are the 2 very important ones wanted. In case you skip this step, you’ll most likely see warnings whilst you decide to Git. This makes extra give you the results you want as a result of you’re going to then must revise the commits you have got achieved with the corrected data.


You must now have Git put in and able to make use of to your gadget.

To be informed extra about the best way to use Git, take a look at those articles and collection: