Git is a source code management system. It allows a teams to collaborate on projects, using the same files. Git watches for changes in your files and and allows for files to be shared between small or large groups of people.
We recommend this free online book to really learn more about Git and its capabilities:
http://git-scm.com/book/en/v2 Install Git Using Yum
Git is available from CentOS's main repositories and can be installed easily. To install Git through 'Yum' enter the following in your terminal:
yum install git
Yes its that simple using the repositories! Install Git from Source
If you want the most up to date version of git, you can download the most recent version from source and then compile it.
To get started, first you will need to install Development Tools if not already installed:
sudo yum groupinstall "Development Tools"
Git has some extra dependencies that we need to install:
sudo yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel
Once these are installed, fetch the latest version of Git available at github.com:
cd /usr/src wget -O git.zip https://github.com/git/git/archive/master.zip
Now you need to unzip the archive and change into the newly created project directory:
unzip git.zip cd git-master
Now we need to configure the package, build the executables and any documentation, and we can then install it by entering the following commands in your terminal:
make configure ./configure --prefix=/usr/local make all doc sudo make install install-doc install-html
Git can be updated easily. To update you first clone the Git repository into a new directory then build and install it just like the previous steps:
git clone git://github.com/git/git
How To Set Up Git
In order to use Git we will need to setup some basic information. Why? When you commit any changes with git, it embeds your name and email address into the commit message so you can track any changes.
Enter the following commands to give Git the information it requires:
git config --global user.name "Example Name" git config --global user.email "firstname.lastname@example.org"
These changes will be stored in a file in your home directory. You can view them with your favorite text editor:
nano ~/.gitconfig [user] name = Example Name email = email@example.com
The information can also be viewed by querying Git:
git config --list user.name=Example Name firstname.lastname@example.org
Warning! Git may try to fill in these values automatically if you forget to set up these steps! Conclusion
Git is a very powerful and is highly recommended for any development project. Don't forget we also recommend this free online book to really learn more about Git and its capabilities:
Thats the end of the tutorial! Git is installed, set-up and ready to go.