<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dave Gardner - PHP Developer &#187; github</title>
	<atom:link href="http://www.davegardner.me.uk/blog/tag/github/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davegardner.me.uk/blog</link>
	<description>Just behind the bleeding edge of PHP.</description>
	<lastBuildDate>Fri, 02 Jul 2010 08:25:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up Git on CentOS 5 server</title>
		<link>http://www.davegardner.me.uk/blog/2010/01/29/setting-up-git-on-centos-5-server/</link>
		<comments>http://www.davegardner.me.uk/blog/2010/01/29/setting-up-git-on-centos-5-server/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 16:42:49 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[scm]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.davegardner.me.uk/blog/?p=79</guid>
		<description><![CDATA[I'm currently setting up Git for our company. The reason is that Git is better than X! This post is all about how to get Git setup on CentOS 5 including creating and sharging a repository.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently setting up <a target="_blank" href="http://git-scm.com/">Git</a> for our company. The reason is that <a target="_blank" href="http://whygitisbetterthanx.com/">Git is better than X</a>. This post is all about <strong>how to get Git setup on CentOS 5</strong>. There are other posts on this topic, of course, but this one is better!</p>
<ul>
<li><a href="#intro">Two minute intro to Git</a></li>
<li><a href="#install">Installing Git on CentOS 5</a></li>
<li><a href="#creatingrepo">Creating and sharing a repository</a></li>
<li><a href="#tortoise">Tortoise; the familiar client for Windows</a></li>
<li><a href="#github">Git hub</a></li>
<li><a href="#moreinfo">Finding out more &#8211; useful links</a></li>
</ul>
<h3><a name="intro">Two minute intro to Git</a></h3>
<p>I&#8217;ve come from an SVN background; you checkout a copy of a central repository, make some changes and commit. Git is a slightly different beast in that it is a <em>distributed</em> Source Control Management system. What this means is that you have your <strong>own</strong> local repository where you can happily commit changes (whether online or offline). To share your changes with others, you can then <strong>push</strong> your changes to another repository (either their repository or some central repository if you&#8217;d prefer). Similarly, to work on someone else&#8217;s code, you can create your own <strong>cloned</strong> version of their repository and then <strong>pull</strong> updates as required.</p>
<p>The reason I&#8217;m switching to Git is all about branching &#8211; I find this a real pain in SVN. If you&#8217;re not convinced you can <a target="_blank" href="http://whygitisbetterthanx.com/">click here to find out Git is better</a> than your current SCM.</p>
<h3><a name="install">Installing Git on CentOS 5</a></h3>
<p>Installing Git on CentOS 5 is easy if you make use of the <a target="_blank" href="http://fedoraproject.org/wiki/EPEL">EPEL</a> (Extra Packages for Enterprise Linux) repository. You&#8217;ll know if you&#8217;ve got this installed if the following fails:</p>
<pre class="code">
yum install git
</pre>
<p>To setup EPEL all you need to do is create a file <strong>/etc/yum.repos.d/epel.repo</strong> and then paste in the following:</p>
<pre class="code">
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&amp;arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&amp;arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&amp;arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
</pre>
<p>Now you can install using:</p>
<pre class="code">
yum install git git-daemon
</pre>
<h3><a name="creatingrepo">Creating and sharing a repository</a></h3>
<p>Creating a repository is easy! Simply create a folder and type <strong>git init</strong>.</p>
<pre class="code">
mkdir newrepo
cd newrepo
git init
</pre>
<p>Once created, we can copy/create our files (think svn import) and then do:</p>
<pre class="code">
git add .
git commit
</pre>
<p>Once you&#8217;ve created a repository, you&#8217;ll probably want to <strong>share it</strong>. This means that other people can pull and push changes. There are a number of ways of accomplishing this (<a target="_blank" href="http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/">this blog post lists 8 possibilities</a>). My usual method for sharing SVN repositories is via Apache; Git supports this as well. I think one of the simplest solutions is to use the Git Deamon. To allow others to pull <strong>and</strong> push you can share your Git repository using the following command:</p>
<pre class="code">
git daemon --reuseaddr --base-path=/path/to/repos --export-all --verbose --enable=receive-pack
</pre>
<p>This command will share <strong>all repositories</strong> found within the folder <strong>/path/to/repos</strong> (so we would have created our &ldquo;newrepo&rdquo; folder within this location). Once shared you can clone the repository using the git resource locator syntax:</p>
<pre class="code">
git clone git://remote.computer.hostname/newrepo
</pre>
<p>Or you can just use the IP address if you&#8217;d prefer.</p>
<p>You should now have a repository setup on a CentOS 5 server which you can clone and then pull/push updates.</p>
<h3><a name="tortoise">Tortoise; the familiar client for Windows</a></h3>
<p>When I&#8217;ve used <a target="_blank" href="http://mercurial.selenic.com/">Mercurial</a> in the past (another distributed SCM), I&#8217;ve actually found the command line tools significantly easier to use than the GUI (Tortoise). However there is a level of familiarity that a TortoiseSVN-like frontend provides.</p>
<p><a href="http://www.davegardner.me.uk/blog/wp-content/uploads/2010/01/tortoisegit.jpg"><img src="http://www.davegardner.me.uk/blog/wp-content/uploads/2010/01/tortoisegit.jpg" alt="Tortoise Git" title="Tortoise Git" width="488" height="607" class="alignnone size-full wp-image-85" /></a></p>
<p><a target="_blank" href="http://code.google.com/p/tortoisegit/">TortoiseGit</a> has all the features you&#8217;d be used to from using TortoiseSVN plus <strong>Pull</strong>, <strong>Push</strong> and all the other Git-specific stuff.</p>
<h3><a name="github">Git hub</a></h3>
<p>It&#8217;s worth making a quick mention of <a target="_blank" href="http://github.com/">Git Hub</a>. According to the website, &ldquo;GitHub is the easiest (and prettiest) way to participate in that collaboration: fork projects, send pull requests, monitor development, all with ease.&rdquo;.</p>
<p>Git Hub provides a handy way of visualising a Git project (listing commits, branches and pretty-printed code). It avoids the need to setup your <em>own</em> central Git repository and mess about setting the server up. A lot of projects seem to be moving this way, for example <a target="_blank" href="http://github.com/symfony/symfony">Symfony</a>.</p>
<h3><a name="moreinfo">Finding out more &#8211; useful links</a></h3>
<h4><a target="_blank" href="http://whygitisbetterthanx.com/">http://whygitisbetterthanx.com/</a></h4>
<p>Some well thought out and concise arguments as to why Git is better than other SCM systems.</p>
<h4><a target="_blank" href="http://gitready.com/">http://gitready.com/</a></h4>
<p>Excellent site &#8211; &ldquo;learn git one commit at a time&rdquo;. Lots of help and advice clearly laid out.</p>
<h4><a target="_blank" href="http://git.or.cz/course/svn.html">http://git.or.cz/course/svn.html</a></h4>
<p>Crash course for SVN users &#8211; really good comparison of SVN commands and the equivalent GIT commands.</p>
<h4><a target="_blank" href="http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/">http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/</a></h4>
<p>8 ways to share your git repository &#8211; file share, Git daemon, plain SSH server, SSH server git-shell, Gitosis, Apache http + gitweb, github.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davegardner.me.uk/blog/2010/01/29/setting-up-git-on-centos-5-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
