• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Git on CentOS 7 System

Written by Admin, Updated On June 10, 2019
centos, git
How to Install Git on CentOS 7

Git is the most popular distributed version control system. It helps to track changes in source code during software development. It allows to collaborate with programmers, revert to previous changes and create branches. This tutorial will describe how to install Git on CentOS 7 system.

Prerequisites#

You must have logged in with non-root user account with sudo privileges.

Install Git on CentOS 7#

You should enable Git repository to install latest Git on your CentOS system. At first, you need to create YUM repository configuration file in /etc/yum.repos.d/ directory with name wandisco-git.repo. Run the below command to do it:

sudo nano /etc/yum.repos.d/wandisco-git.repo

Add the following lines to file:

[wandisco-git]
name=Wandisco GIT Repository
baseurl=http://opensource.wandisco.com/centos/7/git/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco

Save and exit using CTRL+X then typing ‘Y’.

Next, Import GPG key for added repository key typing below command.

sudo rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco

Now you can install Git by executing below command:

sudo apt install git

Once the installation is finished you can verify by typing:

git --version

It will show output like below:

Output
git version 2.18.0

That’s all. You have successfully installed Git version on you CentOS 7 system.

Setting Up Git#

Now your Git is installed and you need to configure it by setting up email address and username:

git config --global user.name "Your Name"
git config --global user.email "youremail@ yourdomain.com"

You can see entered details by typing:

git config --list
Output
user.name=Your Name
user.email=youremail@yourdomain.com

These settings are stored at ~/.gitconfig file and you can see content as below:

[user]
   name = Your Name
   email = yourname@yourdomain.com

You can make other git configuration changes by using git config command or you can edit the ~/.gitconfig file manually.

Conclusion#

Finally, you have learned how to install Git on your CentOS server and how to Setting up Git. You can learn more about Git at Pro Git Book.

If you face any problem at installation time, leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Tomcat 9 on Ubuntu 18.04
Next Article   Chown Command in Linux

Related Posts

  • How to Install Git on Ubuntu 22.04

    How to Install Git on Ubuntu 22.04

    December 10, 2022
  • How to Install Gitea on Ubuntu 22.04

    How to Install Gitea on Ubuntu 22.04

    November 22, 2022
  • How to Install Git on Debian 11

    How to Install Git on Debian 11 Linux

    November 20, 2022

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook