Git is a widely-used version control system that tracks software development project changes. It allows multiple developers to work on a project simultaneously while keeping a record of all changes made to the code. Incorporating Git into your daily CentOS Stream desktop can bring many benefits, including collaborating with other developers, keeping track of changes made to your code, and quickly reverting to previous versions of your code.
List of Git features:
- Distributed version control
- Branching and merging
- Staging area for commits
- Ability to create and manage multiple branches
- Full revision history
- Support for distributed teams
- Ability to rollback to previous versions
- Support for multiple protocols, including HTTP, SSH, and Git
- Extensive file support with Git LFS
- Support for various platforms, including Windows, Linux, and macOS
In summary, Git is a powerful version control system that can benefit your daily CentOS Stream desktop. It allows for collaboration and easy management of changes to your code. Git’s features, such as branching, merging, and the ability to revert to previous versions, make it an essential tool for software development projects. Additionally, its support for multiple platforms and protocols makes it accessible to many users. The following guide will cover installing Git on your CentOS Stream distribution.
Table of Contents
Update CentOS Stream
First, update your system to ensure that all existing packages are up-to-date.
sudo dnf upgrade --refresh
Method 1: Using the DNF Package Manager
The first method to install Git on CentOS Stream is by using the package manager. A package manager is a built-in tool with CentOS Stream that allows you to install and manage software packages quickly. To install Git using the package manager, use the following command.
sudo dnf install git -y
This command will install Git and all of its dependencies on your system.
Method 2: Compiling from Source
The second method to install Git on CentOS Stream is compiling it from the source code. This method is helpful if you need a specific version of Git unavailable in the package manager or if you want to install Git with custom configurations.
First, visit the release page to find the latest stable version or a particular version you are after. Then download it using the wget command.
At the time of this tutorial, 2.39.0 was the latest, but this will change in time, so please ensure you grab the latest link and regularly check back to keep running the same method to update your GIT version.
Run the following command that will extract the source code.
tar -xzf git-x.x.x.tar.gz
Navigate to the directory.
First, I would advise to install the development tools, which will install nearly all required dependecies.
sudo dnf groupinstall "Development Tools"
Lastly, a few extra ones not covered in the development tools pack are required, run this command to install them.
sudo dnf install libcurl-devel expat-devel
Now run the make command to configure the script.
sudo make prefix=/usr/local all
Example output if successful:
Next, install Git.
sudo make prefix=/usr/local install
Example output if successful:
Optionally, you can run Git in the terminal as well like seen above that should print out the version of Git you installed. Congratulations, you have compiled Git.
In this article, we have discussed the two ways to install Git on CentOS Stream using the command-line terminal. The first method is using the package manager, which is the easiest and quickest way to install Git. The second method is compiling from source, which is useful if you need a specific version of Git or want to install Git with custom configurations. Whichever method you choose, Git is a powerful version control system that can bring many benefits to your software development projects.