Git is a version control software. It was built with the idea of improving efficiency and reliability, while maintaining versions of any project when there are a large number of source files.
Git was originally developed by Linus Torvalds to allow himself and his team to have better control over the different versions of the Linux kernel. Since that time, Git has become something bigger, something better: an agile and fully functional distributed version control software for all kinds of DEVS.
Today, you will learn how to install Git on CentOS Linux, which is one of the most widely used Linux distributions.
On CentOS, the most practical and easy way to install Git is using the YUM package manager:
yum install git
However, that doesn’t always give you the latest official version. If you want to get the latest version, then you have to jump into the source installation, as you see below:
Install development tools:
yum groupinstall "Development Tools"
Install other dependencies:
yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel
Jump into the source code:
cd /tmp/ wget -O git.zip https://github.com/git/git/archive/master.zip unzip git.zip cd git-master
Configure the Git package, so you can compile and install:
make configure ./configure --prefix=/usr/local make all doc make install install-doc install-html
Check that Git was installed correctly by running:
The output should show you the current Git version:
[root@localhost git-master]# git --version git version 2.1.0
To run a commit on Git, you must specify your name and email address. This will be attached to the Linux terminal that you are using. To enter your personal details, run this command:
git config --global user.name "Your Name" git config --global user.email "firstname.lastname@example.org"
To see your current configuration, issue the following command:
git config --list user.name=Your Name email@example.com
At this time, you should have Git installed and fully working on your CentOS box. To start working with Git, you can use the following basic Git commands.
Start the daemon on a Git repo:
git --bare init
Clone a repo on the path where you are right now:
git clone [url of repo]
Prepare all of the changes that you made on your local host machine and push a commit over the repo:
git add --all
Run a commit with all of the changes that you’ve applied over the files and set a reference message:
git commit -m "Message"
Update your local files with the ones that are located in the repo; fetch the latest updated files from the online repo:
Send changes to your repo. You can pass two options with this command: 1) your origin repo, which is “origin” by default and 2) the variable that is your branch, which is “master” by default:
git push [origin] [branch]
What do you think about Git? Or do you use another version control software? We’d love to know what you think about it.
Popular search terms:
- centos 6 install git
- centos 7 git nginx
- centos 7 nginx git
- centos git