Git is one of the most used free and open-source version control repository management tools. Most programmers, developers, and software quality controllers use Git for professional use. Git is super scalable and super fast to use. It can also handle data version control for Big data analysis and other data analysis-related tasks. If you’re a software developer, you must learn Linux and Git simultaneously to develop your skills. Very often, Git is used to showing as a skill for getting hired in any programming job. On the other hand, if you have a large software project where many developers update, modify and write new codes, Git is totally for you. Using Git, you can check who made what changes, who wrote which part of the project. Even Git also allows you to retrieve the versions if necessary.
Git on Linux Distributions
If you find the acronym of Git, you can see it actually stands for Global Information Tracker. Git is written in C, Perl, and Sheel. It was first developed by Linus Torvalds for developing the Linux kernel. Nowadays, Git is wildly used for development, software implementation, and merging.
In Linux, Git can clone a repository, and it can be used locally without having any complicated server or any complex framework. In this post, we will see how to install Git in a Linux system.
1. Install Git on Ubuntu/Debian Linux
The Git tool is available on the Linux official repository. If you’re a Debian distribution user, you can run the following aptitude commands given below to update your system repository and install Git on your machine. The commands will be executable on all Debian-based distributions.
$ sudo apt-get update
$ sudo apt-get install git
After finishing the installation, run a version check command to confirm whether Git is installed or not.Â
$ git --version
2. Install Git on Fedora and Red Hat Linux
If you’re using a Fedora workstation or a Red Hat-based Linux system, you can run the following DNF or YUM command to install Git on your system.Â
Run the DNF command with root access to install Git on the Fedora workstation.Â
$ sudo dnf install git
The following YUM command will install Git on the Red Hat-based Linux systems.
$ sudo yum install git
When the installation ends, run the git command to check the Git version to ensure that it is installed correctly on your system.
$ git --version
3. Install Git on Arch and SuSE Linux
Arch-based Linux users can run the following Pacman commands given below with root access to update your system repository and install Git on your system.
sudo pacman -Syu
sudo pacman -S git
If you’re a SuSE user, run the following zypper command given below with root privilege to install Git on your system.
# zypper install git
Finally, after a successful installation, you can now check the version of Git on your Linux machine.
# git --version
4. Install Git on Linux from Source Code
Installing Git is now more convenient with source codes. If you’re a Debian or Fedora user, this method will guide you in installing Git on your Linux machine. In addition, by using the source code, you can monitor what actually you’re installing to run Git on the system.
1. Install Git on Debian By Source Code
Ubuntu and other Debian-based distribution users need to run the following aptitude commands given below to update the system repository and install the Git-dependency packages in the system.
$ sudo apt-get update
$ sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev asciidoc xmlto docbook2x
Now, run the following command to clone the Git kernel on your system.
$ git clone https://git.kernel.org/pub/scm/git/git.git
Then, run the make commands to set the prefix and install Git on your Linux machine.
$ make all doc info prefix=/usr
$ sudo make install install-doc install-html install-info install-man prefix=/usr
2. Install Git on Fedora By Source Code
Installing Git on a Fedora workstation is pretty similar to installing it on Debian distributions. First, run the following DNF commands given below to install the Extra Packages for Enterprise Linux (EPEL) and the dependency packages on your system.
$ sudo dnf install curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto docbook2X
$ sudo yum install epel-release
$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto docbook2X
Now, create a symbolic link on your system for Git. Then clone the Git package on your system directory.
$ sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
$ git clone https://git.kernel.org/pub/scm/git/git.git
You can now run the make commands given below with root privilege on your terminal shell to install Git on your Fedora workstation.Â
$ make all doc prefix=/usr
$ sudo make install install-doc install-html install-man prefix=/usr
Get Started with Git
When the Git installation ends, you may now edit the configuration script to set up your user credentials. Run the following Git config commands given below to set your user name and the email address on your system.Â
$ git config --global user.name "UbuntuPIT"
$ git config --global user.email "[email protected]"
You can also verify and edit the Git configuration script on your Linux machine to set custom parameters. For example, run the following git command to verify Git.Â
git config --list
Run the following command with root access to edit the Git configuration file on your Linux machine.
nano ~/.gitconfig
Remove Git From Linux
If you ever need to remove Git from your machine, please run the following commands below according to your distribution to remove Git.Â
Debian users may run this command to remove Git.
sudo apt-get remove git
Fedora and Red-Hat Linux users need to run the following commands to remove Git from the system.
yum remove git
yum clean all
yum install git
If you’re an Arch Linux user, you can find options to remove Git from the default GUI-based software control tool.
Final Words
Often developers use centralized software developing tools for better production and debugging. But, using Git is excellent because if you use a centralized system, that can be less productive if the main server goes down.
On the contrary, distributed systems like Git don’t use any centralized system, so there is no chance to completely goes the system down. In the entire post, we have seen how to install and use Git on a Linux system.
I hope this post has been informative for you; please share this post with your friends and the Linux community. You can also write down your opinions in the comment section regarding this post. Finally, if you are keener about Git on Linux, please go through this post to learn about more Git commands.