Many software and tools are designed to make things easier for web developers. And certainly “Git” is one of the most important ones. But what is Git in simple words? 

Git, defined as a version control system, is essential to modern software development. Version control systems, in general, let you track your software and any changes. 

You can handle all your projects with this open-source and distributed version system. This guide show you how to install Git on Ubuntu.

How to install Git on Ubuntu?

You have two options for installing Git on your system:

Using apt: The first is installing apt from the official Ubuntu repository. Using this way offers you a simple and fast installation process. 

But the version the repository offers may not be the latest version, which can cause a tiny problem.

Using source code: If it is important for you to install the latest version, this way works better. Using source code to install Git on Ubuntu may be more complicated.

We’ll discuss both ways, and you are the one who should choose the best way considering your needs. Follow the steps below.

First method: Using apt

If you’re looking for the easiest way, do not hesitate and start the installation using the apt. Pay attention that the version in the repository is not usually the least. So, if you want the latest version, ignore this part and continue with the second method.

  • Update your system package index for the first step.
  • Press “Ctrl+Alt+T” to open the terminal window.
  • Enter the command below:

sudo apt update

  • Enter this command “sudo apt install git” and let the installation start. Wait for the installation to be completed. 
  • Run this command to verify the installation process: 

git –version

And that’s it.

Second method: Using source code

You can download and install the latest Git version using source code. Follow these steps:

  • First, you must download and install several dependencies to start the installation process. Enter this command and wait for the installation to be completed:

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

  • Now you need to create a temporary directory and move the dependencies into it using these commands: 

mkdir tmp

cd /tmp

  • Now, head to this address through a browser window:

https://mirrors.edge.kernel.org/pub/software/scm/git/

  • A list of Git releases will appear in this window. Search for the latest version or any version you want to install. Consider its number and put it in the command below:

curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-X.XX.X.tar.gz

  • Imagine 2.38 is the latest version. To download it use the curl command. Then, change its name to: git.tar.gz:

curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.38.1.tar.gz

This command brings you the Git tar file.

  • You need to uncompress the tarball file using this command:

tar -zxf git.tar.gz

  • Now move the file to the new Git directory:

cd git-*

  • Enter these commands to compile your package:

make prefix=/usr/local/

  • Wait for the process to be completed and start the installation by entering this command:

sudo make prefix=/usr/local install

  • Run this command to verify the installation process: 

git –version

After doing all these, the installation would be done and you need to set it up and start using it.

?? Safeguard your online projects with our secure and reliable Linux VPS hosting! ?? Enjoy maximum uptime, lightning-fast speeds, and seamless scalability for your website or application. ?? 

How to configure Git on Ubuntu?

Now you know how to install Git on Ubuntu. You need to enter your name and email address. To do so, follow these steps:

  • Open the terminal window by pressing “Ctrl+Alt+T” and enter this command:

git config --global user.name "your_name"

git config --global user.email [email protected]

  • replace “your name” and [email protected] with your name and email address.
  • Run this command to verify the configuration changes: 

git config –list

The name and email address you entered will be displayed on the system.

Conclusion

Git is an essential part of a web developer’s job. In this article, we showed you how to install Git on Ubuntu and configure it. So your system will be ready for you to use this program.

People also read: