Install Git on Ubuntu 18.04
- arjun5792
- Oct 28, 2022
- 2 min read
Do you know how to install Git on Ubuntu 18.04 and how to use Git?
We'll examine its installation.
Why is the use of version control systems so crucial?
Maintaining version control is crucial for tracking changes. Git is a program used to distribute updates from the local machine to the repository and vice versa. Nowadays, sites like GitHub and GitLab host the majority of the projects' files in a Git repository.
Follow changes
Return to the earlier phases.
Branch to produce backup copies of directories and files.
Git also makes it possible to track changes to files and source code.
Installing Git on Ubuntu 18.04
To install git on Ubuntu 18.04, you need to have root access as a prerequisite.
Using the default packages to install Git
The local package index is first updated using the apt package management tools. Install Git after the update is finished by downloading it:
apt update
apt install git
We check to see if Git was properly installed by running the following command:
git --version
Output appears as,
git version 2.17.1
2. Git installation from the source
Git can be installed more securely and safely by compiling the program from source code. Compared to the other method, this takes more time. However, it offers some control over the customization options and permits downloading the most recent release.
Installing the Git-dependent software is the first step. We update the local package index and then install the packages because everything we need is already available in the default repositories.
apt update
apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
3. The version of Git is accessible by going to the Git project's mirror on GitHub, which is located at the following URL:
https://github.com/git/git
4. Next, we click the Clone or Download button on the right side of the page, then right-click Download ZIP and copy the link address that ends in.zip.
5. The next step is to download temporary files from the tmp directory.
cd /tmp
6. Once more, we install the copied zip file link using the command-line tool wget. We give the file a fresh name. gitfile.zip.
wget https://github.com/git/git/archive/v2.18.0.zip -O gitfile.zip
7. Type: to unzip the downloaded file and move it into the directory that results.
unzip gitfile.zip
cd git-*
Now, enter the following two commands to create the package and install it:
make prefix=/usr/local all
make prefix=/usr/local install
At last, by typing git -version, we check to see if the installation was successful.
Conclusion
In summary, Git allows you to track changes in source code and files. In today's article, we examined the installation of Git on Ubuntu 18.04 by our Technical Support Team.
Comments