Git provides support for non-linear, distributed development, allowing multiple contributors to work on a project simultaneously. Git was designed and developed by Linus Torvalds for Linux kernel development. In addition, Git is the most popular distributed version control and source code management system.
This guide explains how to install the latest version of Git on CentOS 7 / RHEL 7 using the Wandisco GIT Repository. Furthermore, Git can also be compiled from source and installed on any operating system using their respective package managers.
Step 1./ Adding Wandisco GIT Repository
– To add the Wandisco GIT repository we need to create a new YUM repository configuration file named WANdisco-git.repo
in /etc/yum.repos.d/
directory:
# sudo cat > /etc/yum.repos.d/WANdisco-git.repo << EOF [WANdisco-git] name=WANdisco Git baseurl=http://opensource.wandisco.com/rhel/\$releasever/git/\$basearch gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-WANdisco EOF
- Import the WANdisco repository GPG key like below:
# sudo rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
Step 2./ Installing Git
- Once the repository is added, to install the latest version of Git run the following command:
# sudo yum install git
Step 3./ Verifying the installation
- To verify the installation type the following command which will print the Git version:
# git --version git version 2.18.0
Step 4./ Configuring Git
- You need to submit some information about yourself so that commit messages will be generated with the correct information attached. Use the following commands to provide Name and Email address that will be embedded into your code commits:
# git config --global user.name "Waderni Lotfi" # git config --global user.email "[email protected]"
- To check if your configurations are added successfully, use the below command:
# git config --list user.name=lotfi [email protected]
Conclusion
You have successfully installed the latest version of Git on your CentOS 7 / RHEL 7 operating systems. Last but not least, oo learn more about how to use Git you can visit the Git official Documentation website. You might want to check the following guides: