<?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>Silas Sewell - Git</title>
        <atom:link href="http://www.silassewell.com/blog/tag/git/rss2.xml" rel="self" type="application/rss+xml" />
        <link>http://www.silassewell.com/blog/tag/git</link>
        <description>Infrastructure Development</description>
        <lastBuildDate>Sat, 21 Aug 2010 00:00:00 GMT</lastBuildDate>
        <generator>http://www.silassewell.com/</generator>
        <language>en</language>
        <sy:updatePeriod>hourly</sy:updatePeriod>
        <sy:updateFrequency>1</sy:updateFrequency>

        <item>
            <title>Profile Management with Git and GitHub</title>
            <link>http://www.silassewell.com/blog/2009/03/08/profile-management-with-git-and-github/</link>
            <pubDate>Sun, 08 Mar 2009 00:00:00 GMT</pubDate>
            <dc:creator>silas</dc:creator>
            <category><![CDATA[Bash]]></category><category><![CDATA[Configuration Management]]></category><category><![CDATA[Git]]></category><category><![CDATA[Projects]]></category><category><![CDATA[Systems Administration]]></category>
            <guid isPermaLink="true">http://www.silassewell.com/blog/2009/03/08/profile-management-with-git-and-github/</guid>
            <description><![CDATA[<p>The following describes a simple way to manage you profile configuration files using GitHub.</p>

<h3>Features</h3>

<ul>
<li>Centralized configuration management</li>
<li>Files live in their native locations (no symbolic linking)</li>
<li>Home directory is not a Git repository</li>
<li>All the power of git with a simple alias</li>
</ul>

<h3>Setup Repository</h3>

<ul>
<li>Log into <a href="http://github.com/" title="GitHub">GitHub</a> and create a repository named config</li>
<li>Add your <a href="http://github.com/guides/providing-your-ssh-key" title="Public Keys to GithHub">public keys to GitHub</a> (if you haven't done so already)</li>
<li><p>Open a terminal and switch to your home directory</p>

<pre><code class="prettyprint">cd ~
</code></pre></li>
<li><p>Create a configuration directory</p>

<pre><code class="prettyprint">mkdir .config.git
</code></pre></li>
<li><p>Add the following alias to your current session and your <code class="prettyprint">.bash_profile</code></p>

<pre><code class="prettyprint">alias config='git --git-dir=$HOME/.config.git/ --work-tree=$HOME'
echo "alias config='git --git-dir=$HOME/.config.git/ --work-tree=$HOME'" &gt;&gt; .bash_profile
</code></pre></li>
<li><p>Add your <code class="prettyprint">.bash_profile</code> to the configuration repository</p>

<pre><code class="prettyprint">config add .bash_profile
</code></pre></li>
<li><p>Commit the changes</p>

<pre><code class="prettyprint">config commit -m 'Initial commit'
</code></pre></li>
<li><p>Change the origin to GitHub</p>

<pre><code class="prettyprint">config remote add origin git@github.com:GITHUB_USERNAME/config.git
</code></pre></li>
<li><p>Push the changes</p>

<pre><code class="prettyprint">config push origin master
</code></pre></li>
</ul>

<p>If you get an error when running <code class="prettyprint">config pull</code> to the effect of <code class="prettyprint">You asked me to pull without...</code> run the follow:</p>

<pre><code class="prettyprint">    echo -e '[branch "master"]\n  remote = origin\n  merge = refs/heads/master' &gt;&gt; ~/.config.git/config
</code></pre>

<h3>Setup Configuration Management on a Different System</h3>

<ol>
<li>Add your <a href="http://github.com/guides/providing-your-ssh-key" title="Public Keys to GithHub">public keys to GitHub</a> (if you haven't done so already)</li>
<li><p>Switch to your home directory</p>

<pre><code class="prettyprint">cd ~
</code></pre></li>
<li><p>Backup your local configuration files, example:</p>

<pre><code class="prettyprint">mv .bash_profile .bash_profile.bk
</code></pre></li>
<li><p>Clone your configuration repository</p>

<pre><code class="prettyprint">git clone git@github.com:GITHUB_USERNAME/config.git config.git
</code></pre></li>
<li><p>Move the git metadata to <code class="prettyprint">~/.config.git</code></p>

<pre><code class="prettyprint">mv config.git/.git .config.git
</code></pre></li>
<li><p>Enable dotglob</p>

<pre><code class="prettyprint">shopt -s dotglob
</code></pre></li>
<li><p>Move your configuration files to your home directory</p>

<pre><code class="prettyprint">mv -i config.git/* .
</code></pre></li>
<li><p>Delete the <code class="prettyprint">config.git</code> directory</p>

<pre><code class="prettyprint">rmdir config.git
</code></pre></li>
<li><p>Logout and log back in</p></li>
</ol>

<h3>Basic Usage</h3>

<ul>
<li><code class="prettyprint">config pull</code> - get latest configuration changes</li>
<li><code class="prettyprint">config add FILENAME</code> - add a configuration file</li>
<li><code class="prettyprint">config commit -a</code> - save all configuration changes</li>
<li><code class="prettyprint">config push</code> - push configuration changes to GitHub</li>
<li>and any other <code class="prettyprint">config GIT_OPTION</code></li>
</ul>

<p>You can see my configuration repository at <a href="http://github.com/silas/config" title="config">http://github.com/silas/config</a>.</p>

<p>Source: <a href="http://robescriva.com/2009/01/manage-your-home-with-git/" title="source">Manage your $HOME with git</a> by Robert Escriva</p>]]></description>
        </item>

    </channel>
</rss>