How to install Git on CentOS

- by

Git-Logo-2ColorGit is a superb version control system that’s tightly integrated into Apple’s Xcode. To collaborate with some coding buddies of mine we wanted to setup a central remote storage on my Plesk server so we could all contribute to the code.

Since we did not want to share our code with the public we wanted to make it secure. So secure in fact that we could contribute from coffee shops around the world, hence we decided to use Git with SSH. This is probably the easiest and most straightforward way for read/write access to Git remotes: no daemon to setup, to Firewall to tweak – all we needed was a set of SSH credentials and a server running Git with a bit of space.

I have already covered how to setup SSH access under Plesk in my previous article. My server is running CentOS 5.8.

Git supports four protocols in total:

  1. SSH (secure, works for read/write access – we’ll use this)
  2. http/https (best for read access, write access only works using WebDAV – read: headaches)
  3. git (requires proprietary daemon and a port – read: headaches)
  4. local (only works on mounted disks – unsuitable for our needs)

To install Git all we need to do is use yum. I love yum! Login via SSH as root and type the following command:

yum install git

This will install all git components, including the Git daemon which we don’t need for our project – so alternatively we could just go complacently bare-bones and instead use

yum install git-core

And that’s it! On Debian systems you’d use the apt command, and you can also install Git from source if you prefer. Scott Chacon describes how in his excellent book Pro Git – check it out for free, it’ll answer every question you may have about Git including Version Control workflow and best practices.

All that remains now is to make use of the Git server which I’ll cover in the next article on how to make Xcode speak to Git, and how to push a local repository to the server.

If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.