<?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>selene tan &#187; git</title>
	<atom:link href="http://selenetan.com/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://selenetan.com</link>
	<description>reaching for the moon and sky</description>
	<lastBuildDate>Wed, 16 Feb 2011 06:22:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Git on Dreamhost</title>
		<link>http://selenetan.com/2009/10/git-on-dreamhost/</link>
		<comments>http://selenetan.com/2009/10/git-on-dreamhost/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 08:43:00 +0000</pubDate>
		<dc:creator>selene</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://selenetan.com/?p=51</guid>
		<description><![CDATA[Though my website is hosted on Dreamhost, these days I mostly use them for version control hosting. So I was very happy when they set up git on their servers. Casper Fabricius&#8217; Keeping git repositories on Dreamhost using SSH has some instructions and a handy script for automating the process. Thing is, I tend to [...]]]></description>
			<content:encoded><![CDATA[<p>Though my website is hosted on <a href="http://www.dreamhost.com">Dreamhost</a>, these days I mostly use them for version control hosting. So I was very happy when they set up <a href="http://git-scm.com">git</a> on their servers.</p>
<p>Casper Fabricius&#8217; <a href="http://casperfabricius.com/site/2008/09/21/keeping-git-repositories-on-dreamhost-using-ssh/">Keeping git repositories on Dreamhost using SSH</a> has some instructions and a handy script for automating the process. Thing is, I tend to create the folders and files for a project before I set up the git repository. Casper&#8217;s script assumes you want to create the folder and repository at the same time.</p>
<p>So here&#8217;s my version of the script. If you call it without arguments, it assumes you want to make a repository for the current directory.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="re2">DREAMGIT_DOMAIN</span>=user<span class="sy0">@</span>yourdomain.com</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re4">$#</span> <span class="re5">-lt</span> 1 <span class="br0">&#93;</span>; <span class="kw1">then</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">PROJECT_DIR</span>=<span class="co1">${PWD##*/}</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">PROJECT_DIR</span>=$1</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">mkdir</span> <span class="re1">$PROJECT_DIR</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">cd</span> <span class="re1">$PROJECT_DIR</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">fi</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">ssh</span> <span class="re1">$DREAMGIT_DOMAIN</span> <span class="st_h">&#8216;mkdir -p ~/git/&#8217;</span><span class="re1">$PROJECT_DIR</span><span class="st_h">&#8216;.git &amp;amp;&amp;amp; cd ~/git/&#8217;</span><span class="re1">$PROJECT_DI</span><span class="re1">$git</span> init</div>
</li>
<li class="li1">
<div class="de1">git remote add origin <span class="kw2">ssh</span>:<span class="sy0">//</span><span class="re1">$DREAMGIT_DOMAIN</span><span class="sy0">/</span>~<span class="sy0">/</span>git<span class="sy0">/</span><span class="re1">$PROJECT_DIR</span>.git</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">touch</span> .gitignore</div>
</li>
<li class="li1">
<div class="de1">git add .</div>
</li>
<li class="li1">
<div class="de1">git commit <span class="re5">-m</span> <span class="st_h">&#8216;Created new repo&#8217;</span></div>
</li>
<li class="li1">
<div class="de1">git push origin master</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&quot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st0">[branch <span class="es1">\&quot;</span>master<span class="es1">\&quot;</span>]</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st0">remote = origin</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st0">merge = refs/heads/master&quot;</span> <span class="sy0">&amp;</span>gt;<span class="sy0">&amp;</span>gt;.git<span class="sy0">/</span>config</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&quot;Your new git repo &#8216;<span class="es2">$PROJECT_DIR</span>&#8216; is ready and initialized at</span></div>
</li>
<li class="li1">
<div class="de1"><span class="st0"><span class="es2">$DREAMGIT_DOMAIN</span>/~/git/<span class="es2">$PROJECT_DIR</span>.git&quot;</span></div>
</li>
</ol>
</div>
</div>
<p>Note: both Casper&#8217;s and my scripts still work if you call them with a directory that exists, e.g. <strong>dreamgit dir_that_exists</strong>. You&#8217;ll see <strong>mkdir</strong> spout an error, but the rest will execute.</p>
]]></content:encoded>
			<wfw:commentRss>http://selenetan.com/2009/10/git-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

