Version control is now a crucial instrument in the creation of contemporary software. You may keep track of your programme at the source level using version control tools. To make different versions of files and folders, you can branch off from the source code, track changes, go back in time, and do other things.
Git is one of the most well-known version control programmes. Sites like GitHub, GitLab, and Bitbucket have made sharing and contributing to code with Git easier than ever. Many projects maintain their files in a Git repository.
This tutorial will show you how to set up Git on a CentOS 7 server. We’ll go over how to set up Git so that you can start working together right away, as well as how to install the programme in a few different ways, each with their own advantages.
Prerequisites
There are a few things that need to be done before you start using this instruction.
You’ll need a CentOS 7 server with a non-root user with sudo capabilities installed and set up.
After creating your non-root account, you may use it to SSH into your CentOS server and carry out the Git installation.
Step 1: Git installation
Installing Git from CentOS’s default software repositories is the simplest option. The Git version that is installed via this approach may be older than the most recent version, but it is the fastest method. If you require the most recent release, think about building git from source.
The most recent git package accessible in CentOS’s repositories can be found and installed using yum, the operating system’s native package manager:
# sudo yum install git
Upon successful completion of the command, git will have been downloaded and set up. Try using Git’s built-in version check to confirm that it is operating properly:
# git –version
You can now proceed with setting up Git if that check resulted in a Git version number.
Step 2: Installing Git
After installing git, you will need to specify some personal data so that commit messages will be generated with the appropriate data included. To do this, provide the name and email address you want to be included in your commits using the git config command:
# git config --global user.name "Your Name"
# git config --global user.email you@example.com
We may see every configuration item that has been set by typing: to see if these configurations were added correctly.
# git config –list
Output:
user.name=Your Name
user.email=you@example.com
You will avoid having to review commits after you submit them and getting an error message thanks to this setting.
Conclusion
Git should now be set up and accessible on your machine. Check out these in-depth articles to learn more about using Git: