<?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>guys like dolls &#187; git</title>
	<atom:link href="http://guyslikedolls.com/category/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://guyslikedolls.com</link>
	<description>an exploration of something</description>
	<lastBuildDate>Tue, 06 Jul 2010 23:21:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Git on MacOSX</title>
		<link>http://guyslikedolls.com/2008/03/23/git-on-macosx/</link>
		<comments>http://guyslikedolls.com/2008/03/23/git-on-macosx/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 23:11:08 +0000</pubDate>
		<dc:creator>jcdoll</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[research]]></category>

		<guid isPermaLink="false">http://www.guyslikedolls.com/git-on-macosx</guid>
		<description><![CDATA[I&#8217;ve been playing with Git lately and wanted to share some instructions and gotchas. I&#8217;ve installed Git on 10.5 and 10.3 (which needs a few extras installed) but haven&#8217;t tried them on 10.4 yet, let me know how it goes. From my experience, version control is way underutilized (at least in non-computer engineering) and would [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with Git lately and wanted to share some instructions and gotchas. I&#8217;ve installed Git on 10.5 and 10.3 (which needs a few extras installed) but haven&#8217;t tried them on 10.4 yet, let me know how it goes. From my experience, version control is way underutilized (at least in non-computer engineering) and would reduce the amount of duplicated effort, improve the ability to collaborate, and keep detailed history of important text files (like say your thesis if you&#8217;re using LaTeX, which you should be). Other version control systems I&#8217;ve used are subversion and perforce, but I like git because it&#8217;s super fast, it&#8217;s pretty easy to manage remote repositories over ssh, and it&#8217;s hot right now.</p>
<h4><strong>Initial Setup</strong></h4>
<p>As usual, you need to have the Developer tools installed.</p>
<p>Edit  ~/.bash_login (for just you) or /etc/profile (for all users on your computer)to add /usr/local/bin + sbin to your $PATH variable, e.g. add the following line:</p>
<p><code>export PATH="/usr/local/bin:/usr/local/sbin:$PATH"</code></p>
<h4>Build and Install Git</h4>
<p><code>curl -O http://kernel.org/pub/software/scm/git/git-1.5.4.4.tar.gz<br />
tar -xzvf git-1.5.4.4.tar.gz<br />
cd git-1.5.4.4<br />
./configure --prefix=/usr/local<br />
make all<br />
sudo make install<br />
cd ..</code></p>
<p>If you get a compile error about <strong>po/de.msg make[1]: *** [po/de.msg] Error 127</strong> then you should just be able to run</p>
<p><code>export NO_MSGFMT=1<br />
make all</code></p>
<p>assuming that you only need to install the English interface.</p>
<p>If you get an error like referring to <strong>expat.h</strong> then you will need to build expat using the following commands</p>
<p><code>curl -O http://surfnet.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz<br />
tar xzvf expat-2.0.1.tar.gz<br />
cd expat-2.0.1<br />
./configure<br />
make<br />
make check<br />
sudo make install<br />
cd ..<br />
source /etc/profile</code></p>
<p>To make sure that git is installed and working, trying running <strong>git</strong> from the command line.</p>
<h4>Setting up a remote repository</h4>
<p>In my case, I was interested in setting up our lab server (OSX 10.3) to properly host git repositories. First, install git on the server. Next, add the following to  /etc/profile, which is a handy script to make repository creation easy. The script is great and is from <a href="http://autopragmatic.com/2008/01/26/hosting-a-git-repository-on-dreamhost/">here</a>.</p>
<p><code>newgit()<br />
{<br />
if [ -z $1 ]; then<br />
echo "usage: $FUNCNAME project-name.git"<br />
else<br />
gitdir="/Library/WebServer/Documents/git/$1"<br />
mkdir $gitdir<br />
pushd $gitdir<br />
git --bare init<br />
git --bare update-server-info<br />
chmod a+x hooks/post-update<br />
touch git-daemon-export-ok<br />
popd<br />
fi<br />
}</code></p>
<p>After creating the folder /Library/WebServer/Documents/git you can just run <strong>newgit repository.git</strong> to make an accessible repository.</p>
<p>Here&#8217;s an important step: make sure that /etc/profile properly loads the /usr/local/bin directory (see above). When you push/pull/clone data from your server, things will not go smoothly and will get errors like <strong>git-receive-pack: command not found</strong> or <strong>git-upload-pack: command not found</strong>.</p>
<h4>Installing gitweb</h4>
<p>Git includes a handy .cgi program for viewing your repositories through a browser. It&#8217;s quick to install assuming you have apache setup with mod_perl installed and it&#8217;s setup to serve .cgi files. Checkout the <strong>gitweb </strong>directory in the git source folder after you built git earlier (you didn&#8217;t delete it yet, right?)</p>
<p>At this point you can use git normally on your remote host. Here are some hastily written examples:</p>
<h4>Creating a repository from a directory of existing files</h4>
<p><code>cd PROJECT<br />
git init<br />
git add .<br />
git commit -m "first commit"<br />
</code></p>
<h4>Creating a new repository</h4>
<p><code>mkdir PROJECT<br />
cd PROJECT<br />
git init<br />
(create files, write code)<br />
git add .<br />
git commit -m "first commit"</code></p>
<h4>Putting your code on your server</h4>
<p><code>ssh USERNAME@YOURSERVER<br />
newgit PROJECT.git<br />
git push USERNAME@YOURSERVER:/Library/WebServer/Documents/git/PROJECT.git master</code></p>
<h4>Pulling code from your server</h4>
<p><code>git clone USERNAME@YOURSERVER:/Library/WebServer/Documents/git/PROJECT.git</code></p>
<p>Here are a few additional references to help get started (<a href="http://www.kernel.org/pub/software/scm/git/docs/tutorial.html">1</a>, <a href="http://www.dekorte.com/blog/blog.cgi?do=item&amp;id=2539">2</a>, <a href="http://git.or.cz/course/svn.html">3</a>, <a href="http://www.simplisticcomplexity.com/2008/03/04/git-it/">4</a>, and <a href="http://wincent.com/knowledge-base/Installing_Git_1.5.2.4_on_Mac_OS_X_Leopard">5</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://guyslikedolls.com/2008/03/23/git-on-macosx/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
