<?xml version="1.0" encoding="iso-8859-1"?>
<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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Enquanto isso, na repartição... &#187; General</title>
	<atom:link href="http://www.burocrata.org/blog/archives/category/general/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.burocrata.org/blog</link>
	<description>Relatos do maldito burocrata pigmeu</description>
	<lastBuildDate>Sun, 12 Jun 2011 19:17:40 +0000</lastBuildDate>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/2.5/br/</creativeCommons:license>		<item>
		<title>Exporting code to Git and tiding up its history</title>
		<link>http://www.burocrata.org/blog/archives/2011/06/12/396/exporting-code-to-git-and-tiding-up-its-history/</link>
		<comments>http://www.burocrata.org/blog/archives/2011/06/12/396/exporting-code-to-git-and-tiding-up-its-history/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 19:16:04 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/?p=396</guid>
		<description><![CDATA[Notice: The original guide is available as a GitHub gist at https://gist.github.com/1021890. Nevertheless, its content as on 2011-06-12, is presented bellow. Author: Tiago Alves Macambira [tmacam burocarata org] Licence:Creative Commons By-SA Table of Contents 1&#160;&#160;&#160;Introduction 1.1&#160;&#160;&#160;Objectives 2&#160;&#160;&#160;Starting things up 2.1&#160;&#160;&#160;Importing from the previous version control system 2.2&#160;&#160;&#160;Cloning a repository 3&#160;&#160;&#160;Pruning files from history 3.1&#160;&#160;&#160;Extract a [...]]]></description>
			<content:encoded><![CDATA[<div class="note" style="border: 1px solid black;">
<p class="admonition-title"><strong>Notice:</strong></p>
<p>The original guide is available as a GitHub gist at <a href="https://gist.github.com/1021890">https://gist.github.com/1021890</a>. Nevertheless, its content as on 2011-06-12, is presented bellow.</p>
</div>


<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>Tiago Alves Macambira [tmacam burocarata org]</td></tr>
<tr class="field"><th class="docinfo-name">Licence:</th><td class="field-body">Creative Commons By-SA</td>
</tr>
</tbody>
</table>
<div class="contents topic" id="table-of-contents">
<p class="topic-title first">Table of Contents</p>
<ul class="auto-toc simple">
<li><a class="reference internal" href="#introduction" id="id1">1&nbsp;&nbsp;&nbsp;Introduction</a><ul class="auto-toc">
<li><a class="reference internal" href="#objectives" id="id2">1.1&nbsp;&nbsp;&nbsp;Objectives</a></li>
</ul>
</li>
<li><a class="reference internal" href="#starting-things-up" id="id3">2&nbsp;&nbsp;&nbsp;Starting things up</a><ul class="auto-toc">
<li><a class="reference internal" href="#importing-from-the-previous-version-control-system" id="id4">2.1&nbsp;&nbsp;&nbsp;Importing from the previous version control system</a></li>
<li><a class="reference internal" href="#cloning-a-repository" id="id5">2.2&nbsp;&nbsp;&nbsp;Cloning a repository</a></li>
</ul>
</li>
<li><a class="reference internal" href="#pruning-files-from-history" id="id6">3&nbsp;&nbsp;&nbsp;Pruning files from history</a><ul class="auto-toc">
<li><a class="reference internal" href="#extract-a-single-directory" id="id7">3.1&nbsp;&nbsp;&nbsp;Extract a single directory</a></li>
<li><a class="reference internal" href="#remove-files-and-directory-from-history-for-real" id="id8">3.2&nbsp;&nbsp;&nbsp;Remove files and directory from history for real</a></li>
</ul>
</li>
<li><a class="reference internal" href="#fixing-and-tiding-meta-data" id="id9">4&nbsp;&nbsp;&nbsp;Fixing and tiding meta-data</a><ul class="auto-toc">
<li><a class="reference internal" href="#fix-committer-information" id="id10">4.1&nbsp;&nbsp;&nbsp;Fix committer information</a></li>
<li><a class="reference internal" href="#fix-log-messages" id="id11">4.2&nbsp;&nbsp;&nbsp;Fix log messages</a></li>
</ul>
</li>
<li><a class="reference internal" href="#final-steps" id="id12">5&nbsp;&nbsp;&nbsp;Final steps</a><ul class="auto-toc">
<li><a class="reference internal" href="#shrink-your-repository" id="id13">5.1&nbsp;&nbsp;&nbsp;Shrink your repository.</a></li>
<li><a class="reference internal" href="#final-check" id="id14">5.2&nbsp;&nbsp;&nbsp;Final check</a></li>
<li><a class="reference internal" href="#export-it" id="id15">5.3&nbsp;&nbsp;&nbsp;Export it.</a></li>
</ul>
</li>
<li><a class="reference internal" href="#closing-remarks" id="id16">6&nbsp;&nbsp;&nbsp;Closing remarks</a><ul class="auto-toc">
<li><a class="reference internal" href="#some-missing-things-and-todos" id="id17">6.1&nbsp;&nbsp;&nbsp;Some missing things and TODOs</a></li>
</ul>
</li>
<li><a class="reference internal" href="#references" id="id18">7&nbsp;&nbsp;&nbsp;References</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h3><a class="toc-backref" href="#id1">1&nbsp;&nbsp;&nbsp;Introduction</a></h3>
<p>So you have that awesome (or perhaps a not so awesome but at least not
shameful) project of yours that is just lingering around, collecting
dust and you thought: <em>"What if I released this code to the world? Would
I get famous? Would I became rich? Would I became the next Linus
Torvards?"</em>
Well, I would hate to disappoint you but the answer to those question is
probably <strong>no</strong>.</p>
<p>Nevertheless, be it for self promotion, for pure
generosity or just for the sake of having third-party maintained backup
of your code, releasing it to the world is a Good Thing (tm), and
something that would earn you some karma points -- and we are all short
on those, right?</p>
<p><em>"B-b-but"</em>, you say, <em>"my code is in a &lt;ancient, restraining, démodé or
plain untrendy by last standards&gt; Version Control System and I would
like to do what all the other cool kids are doing and export it as a</em>
<a class="reference external" href="http://git-scm.com/">Git</a> <em>repository in, say,</em> <a class="reference external" href="http://github.com">GitHub</a> <em>or... like... whatever..."</em></p>
<p>Fear no more, dear sheep, this guide is for you.</p>
<div class="section" id="objectives">
<h4><a class="toc-backref" href="#id2">1.1&nbsp;&nbsp;&nbsp;Objectives</a></h4>
<p>This short guide's purpose is to show you how to export a project from
another Version Control System -- or even from another <a class="reference external" href="http://git-scm.com/">Git</a> repository
-- such that its history is represented as cleanly and linearly as
possible.</p>
<p>Perhaps this project my be part of an old corporate project that you
just got approval to release as open source and, although you would like
it to retain as much history information as possible when you release
it, you still has a need (or obligation) to strip from it all and any
sensitive corporate information it has while releasing it. Maybe they are
in the form of sensitive log files that found their way into the
repository, or personal information (e-mails, usernames) that are in the
commit log messages.</p>
<p>So, it's not a matter of just removing, renaming, copying or moving
files around and committing -- as those files would still show up in
history, revealing the information you wanted to protect and taking
unnecessary repository space -- but of doing some serious cleaning and
re-structuring in the source code, its history and associated meta-data
-- whatever that is. This short guide is also about that.</p>
</div>
</div>
<div class="section" id="starting-things-up">
<h3><a class="toc-backref" href="#id3">2&nbsp;&nbsp;&nbsp;Starting things up</a></h3>
<div class="section" id="importing-from-the-previous-version-control-system">
<h4><a class="toc-backref" href="#id4">2.1&nbsp;&nbsp;&nbsp;Importing from the previous version control system</a></h4>
<p>So, the first thing you must do is import your project from the Version
Control System it is currently residing into a <a class="reference external" href="http://git-scm.com/">Git</a> repository.</p>
<p>If it is a subversion repository, <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html">git-svn</a> will do just fine.  If you are
using something else, say, perforce or CVS, similar tools exist to convert your
project and its history to <a class="reference external" href="http://git-scm.com/">Git</a>. You may need to do a intermediary conversion,
say, from CVS to subversion and from subversion to <a class="reference external" href="http://git-scm.com/">Git</a>.</p>
<p>For simplicity, last assume you have a project in a subversion
repository.  Let's also assume that the URL for this repository root is
<tt class="docutils literal"><span class="pre">svn+ssh://svn.example.tld/secure/repositories/meh_project/</span></tt> and that
your project (or the files you want to export) is located in
<tt class="docutils literal">aux/super_dupper_code</tt>.  The following command would fetch this
project and its history from subversion into a new <a class="reference external" href="http://git-scm.com/">Git</a> repository</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">svn</span> clone <span style="color: #660033;">--no-metadata</span> \
 <span style="color: #c20cb9; font-weight: bold;">svn</span>+<span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>svn.example.tld<span style="color: #000000; font-weight: bold;">/</span>secure<span style="color: #000000; font-weight: bold;">/</span>repositories<span style="color: #000000; font-weight: bold;">/</span>meh_project<span style="color: #000000; font-weight: bold;">/</span>aux<span style="color: #000000; font-weight: bold;">/</span>super_dupper_code</pre></div></div>



<p>First, notice that we are not converting the whole repository to <a class="reference external" href="http://git-scm.com/">Git</a>:
we are limiting as much as possible what we are importing from
subversion by grabbing just the code inside the <tt class="docutils literal">super_duper_code</tt>
directory. If, for some reason you had to import the whole repository
into <a class="reference external" href="http://git-scm.com/">Git</a>, do not worry, we will explain how to "prune" it later.</p>
<p>The import may bring some extra files that you may want to remove say, because
they are lame, for some legal reason or because they contain sensitive
information that it is not OK to share with the whole world. We will completely
remove them and their history from the <a class="reference external" href="http://git-scm.com/">Git</a> repository later, hopefully leaving
no trace of them whatsoever.</p>
<p>Since we have no interest in exporting any changes we make back to its original
subversion repository, we are using the <tt class="docutils literal"><span class="pre">--no-metadata</span></tt> option here. It will
also get rid of some extra <tt class="docutils literal"><span class="pre">git-svn-id:</span></tt> lines that <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html">git-svn</a> adds at the end
of every commit. Had we not used the <tt class="docutils literal"><span class="pre">--no-metadata</span></tt> option, we would
need to edit the commit messages to remove them. We will also show how
to modify commit meta-data (commit messages, commit authors etc) later.</p>
</div>
<div class="section" id="cloning-a-repository">
<h4><a class="toc-backref" href="#id5">2.2&nbsp;&nbsp;&nbsp;Cloning a repository</a></h4>
<p>"<em>We did not even got started and we are already cloning my repository?
What gives?</em>", you may ask.</p>
<p>Most of the steps we will give you in the following sections will alter your
<a class="reference external" href="http://git-scm.com/">Git</a> repository in semi-destructive ways, making heavy use of
<a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a>. I say semi-destructive because although <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a>
almost always makes a copy of your repository's previous state, getting back to
this state may be complicated or, depending on the kind of modification
performed by <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a>, impossible.</p>
<p>Additionally, it is of our interest to get rid of any "previous state" we get
and <em>properly</em> cloning a repository does the trick.</p>
<p>So, to avoid regrets and problems, let's first make a <em>proper</em> backup or clone
of your git repository:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> clone <span style="color: #660033;">--no-hardlinks</span> <span style="color: #000000; font-weight: bold;">/</span>XYZ <span style="color: #000000; font-weight: bold;">/</span>ABC</pre></div></div>



<p>Using <tt class="docutils literal"><span class="pre">--no-hardlinks</span></tt> makes <a class="reference external" href="http://git-scm.com/">Git</a> create a clone by really coping the files
and not by using hard-links. This way the original repository won't share files and
metadata with its clone. See the man page if you have no idea of what I am
talking about.</p>
<p>Another way to get the same effect is by using a
<tt class="docutils literal"><span class="pre">file://path/to/your/git/repo</span></tt> URL, as documented  <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html#_checklist_for_shrinking_a_repository">in the section
"Checklist for shrinking a repository" from git filter-branch manpage</a>:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> clone  <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">//</span>full<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>XYZ <span style="color: #000000; font-weight: bold;">/</span>ABC</pre></div></div>



<p>With your backup done, let's move to destruct and reconstruct your <a class="reference external" href="http://git-scm.com/">Git</a> history.</p>
</div>
</div>
<div class="section" id="pruning-files-from-history">
<h3><a class="toc-backref" href="#id6">3&nbsp;&nbsp;&nbsp;Pruning files from history</a></h3>
<p>The import may have brought some extra files.  Now it's time to remove them and
prune the history we have in our Git repository.</p>
<p>Removing them from Git with a <tt class="docutils literal">git rm</tt>  will just remove them from the last
commit, but it will still leave traces and previous versions of those files in
our Git history -- not really what we wanted. We want to remove any trace of
them from the Git repository.</p>
<div class="section" id="extract-a-single-directory">
<h4><a class="toc-backref" href="#id7">3.1&nbsp;&nbsp;&nbsp;Extract a single directory</a></h4>
<p>Suppose you had to bring more files from your precious VCS than you originally
wanted. Say, you imported a whole CVS repository into Git and all you wanted
was a project that lives inside a particular subdirectory. In this case,
instead of removing all the other files and directories, it would be simpler
(and saner) to extract the target subdirectory from the whole mess.</p>
<p>Let's suppose your target subdirectory path is <tt class="docutils literal">projects/parsing/htmlparser</tt>.
The following commands would detach it this from your repository, leaving
nothing but it and its history:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> filter-branch <span style="color: #660033;">--subdirectory-filter</span> projects<span style="color: #000000; font-weight: bold;">/</span>parsing<span style="color: #000000; font-weight: bold;">/</span>htmlparser HEAD <span style="color: #660033;">--</span> <span style="color: #660033;">--all</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> reset <span style="color: #660033;">--hard</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">gc</span> <span style="color: #660033;">--aggressive</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">prune</span></pre></div></div>



<p>Notice that the first command ends in <tt class="docutils literal"><span class="pre">--</span> <span class="pre">--all</span></tt>. That's right: two dashes
space dash-dash-all. That will force Git to rewrite the history for all
branches and tags you have.</p>
<p>Now your repository consists only of the contents of
<tt class="docutils literal">projects/parsing/htmlparser</tt> and its history. Nothing more, nothing less.
Well, you may have mentioned other files in your commit messages but they will
not be there.</p>
</div>
<div class="section" id="remove-files-and-directory-from-history-for-real">
<h4><a class="toc-backref" href="#id8">3.2&nbsp;&nbsp;&nbsp;Remove files and directory from history for real</a></h4>
<p>So, by now we limited our history to the enclosing subdirectory holding all the
files we wanted. But there may still be some extra files that you may not want
to export because they are lame, for some legal reason or because they contain
sensitive information that it is not OK to share with the whole world. Let's
erase them from our repository and from its history altogether.</p>
<p>To remove a file or a directory named <tt class="docutils literal">path/to/SensitiveLogs</tt> from your repository,
run:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> filter-branch <span style="color: #660033;">--index-filter</span> \
  <span style="color: #ff0000;">&quot;git rm -r -f --cached --ignore-unmatch path/to/SensitiveLogs&quot;</span> \
  <span style="color: #660033;">--prune-empty</span> HEAD <span style="color: #660033;">--</span> <span style="color: #660033;">--all</span></pre></div></div>



<p>Remove all files and directory you don't want exported using the command above.</p>
</div>
</div>
<div class="section" id="fixing-and-tiding-meta-data">
<h3><a class="toc-backref" href="#id9">4&nbsp;&nbsp;&nbsp;Fixing and tiding meta-data</a></h3>
<p>OK. As far as files and their history goes, your repository is clean and neat.
But during the process of converting your project and its history to Git, some
commit information such as commit author and commit messages may have been lost
or altered. Perhaps your commit messages mention sensitive data or informs your
previous and now invalid e-mail. Time to fix that.</p>
<div class="section" id="fix-committer-information">
<h4><a class="toc-backref" href="#id10">4.1&nbsp;&nbsp;&nbsp;Fix committer information</a></h4>
<p>Let's start this section with the committer information: its name and
e-mail address.</p>
<p>Once again, we will use <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a> to edit our commit history.
This time, though, I will show two ways to accomplishing the same task.</p>
<p>The first is somewhat more elaborated as it shows how one can
programmatically alter the committer information. Say, for instance,
that except for a given committer, all other committers'
meta-data are OK. So you just want to alter commits related to this guy.
Let's say that this guy was you using a now invalid e-mail address. All
you have to do is alter only those commits where that old and invalid
e-mail is used. Here is how:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> filter-branch <span style="color: #660033;">--commit-filter</span> <span style="color: #ff0000;">'
        if [ &quot;$GIT_COMMITTER_NAME&quot; = &quot;tmacam&quot; ];
        then
                GIT_AUTHOR_NAME=`git config --get user.name`;
                # or ...=&quot;Your (full) Name&quot;;
                GIT_AUTHOR_EMAIL=`git config --get user.email`;
                # or ...=&quot;your.email@example.tld&quot;;
                GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME;
                GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL;
                git commit-tree &quot;$@&quot;;
        else
                git commit-tree &quot;$@&quot;;
        fi'</span> HEAD</pre></div></div>



<p>Notice that this command is assuming that you had already <a class="reference external" href="http://help.github.com/set-your-user-name-email-and-github-token/">configured
your identification information in git</a>.
If this is not your case, just replace those <tt class="docutils literal">git config <span class="pre">--get</span> xxxxxxx</tt>
commands for <tt class="docutils literal">"Your name"</tt> and <tt class="docutils literal">"&lt;your.email@example.tld&gt;"</tt>.</p>
<p>Anyway, as you can see, with some Bash programming kung-fu you can
create a pretty elaborated logic on how to replace or modify
committers' meta-data.</p>
<p>If all you want is to replace <strong>all</strong> committer information for a single
identity, the following one-liner would to the trick:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> filter-branch <span style="color: #660033;">--env-filter</span> <span style="color: #ff0000;">'\
    GIT_AUTHOR_EMAIL=&quot;your.email@example.tld&quot;;\
    GIT_AUTHOR_NAME=&quot;Your (Full) Name&quot;;\
    export GIT_AUTHOR_EMAIL;\
    export GIT_AUTHOR_NAME;\
    export GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL};\
    export GIT_COMMITTER_NAME=${GIT_AUTHOR_NAME};'</span></pre></div></div>



<p>And that's it. All commits will be attributed to "<em>Your (Full) Name
&lt;your.email@example.tld&gt;</em>".</p>
</div>
<div class="section" id="fix-log-messages">
<h4><a class="toc-backref" href="#id11">4.2&nbsp;&nbsp;&nbsp;Fix log messages</a></h4>
<p>Now time to tidy up those commit log messages. Guess what we will use
for this: <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a> and its <tt class="docutils literal"><span class="pre">--msg-filter</span></tt> option. You can
perform almost any kind of editing with this duo: add lines, remove lines,
replace text.  Just give it the name of a program that will alter the
log messages and that's it.  The sky is the limit. <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So, here is a short example of a command that will
remove all those nasty "<tt class="docutils literal"><span class="pre">git-svn-id:</span></tt>" lines that you got in your log
messages just because if did not read what I wrote in the <a class="reference internal" href="#importing-from-the-previous-version-control-system">Importing
from the previous version control system</a> section.:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> filter-branch <span style="color: #660033;">--msg-filter</span> <span style="color: #ff0000;">' sed -e &quot;/^git-svn-id:/d&quot; '</span></pre></div></div>



</div>
</div>
<div class="section" id="final-steps">
<h3><a class="toc-backref" href="#id12">5&nbsp;&nbsp;&nbsp;Final steps</a></h3>
<div class="section" id="shrink-your-repository">
<h4><a class="toc-backref" href="#id13">5.1&nbsp;&nbsp;&nbsp;Shrink your repository.</a></h4>
<p>Now that your repository, its history, commits and their log messages
are all clean, tidy and free from shameful or sensitive information, is
time to do one last thing: shrink your repository.</p>
<p>See, as I said before in the <a class="reference internal" href="#cloning-a-repository">Cloning a repository</a> section,
<a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a> does store some copies of the state of the repository
as it goes modifying it. Now that we got here, we don't need or want
those copies. Time to get rid of them.</p>
<p>Go back to the <a class="reference internal" href="#cloning-a-repository">Cloning a repository</a> section and create another clone
of your repository using the procedures explained there. This should
give you a clean and neat clone to export/upload.</p>
</div>
<div class="section" id="final-check">
<h4><a class="toc-backref" href="#id14">5.2&nbsp;&nbsp;&nbsp;Final check</a></h4>
<p>Use a tool like <a class="reference external" href="http://gitx.frim.nl/">GitX</a> or <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/gitk.html">gitk</a> to analyse your history and look for any missing
or pending problem. Are there any empty branches you want to remove? Do the
commit messages look good? Does your project has any tag or branch that should not be
exported or that makes no sense in being exported? Remove them.</p>
<p>Fix those issues and shrink your repository once again. Yeah, your heard
me right: go clean your repo once again!</p>
<p>Good boy.</p>
</div>
<div class="section" id="export-it">
<h4><a class="toc-backref" href="#id15">5.3&nbsp;&nbsp;&nbsp;Export it.</a></h4>
<p>Well, time to export <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Hooray! But export to where?</p>
<p>Well, there are countless options -- you could setup your own git
environment or use something like <a class="reference external" href="http://github.com">GitHub</a>. I strongly recommend you
taking the latter. Just head to <a class="reference external" href="http://github.com">GitHub</a>'s page, setup an account and
click on the "<tt class="docutils literal">New repository</tt>" button. Fill the presented form and
follow the steps presented there. And that's it <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Your code now lives
in a public <a class="reference external" href="http://git-scm.com/">Git</a> repository and is there for the whole world to see.
Hope you are proud of if -- I really do. <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
</div>
</div>
<div class="section" id="closing-remarks">
<h3><a class="toc-backref" href="#id16">6&nbsp;&nbsp;&nbsp;Closing remarks</a></h3>
<div class="section" id="some-missing-things-and-todos">
<h4><a class="toc-backref" href="#id17">6.1&nbsp;&nbsp;&nbsp;Some missing things and TODOs</a></h4>
<p>I merely covered the steps I usually perform when I move code to <a class="reference external" href="http://github.com">GitHub</a>
from old subversion and CVS repositories of mine that used to hold stuff
from my masters and PhD -- so, there your got it, lame code <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>This means that there are tons of stuff I don't cover here. For
instance:</p>
<ul class="simple">
<li>How to add a copyright notice to all header files, from their
first commit and make them persist across all changes?</li>
<li>How to do the opposite: remove comments or copyright notices from files
and make this removal persist across changes to the files?</li>
<li>Edit the contents of some particular commit message.</li>
</ul>
<p>And so many other issues I don't have to deal with since I own the code
I am releasing. Or because I am lazy to fix everything. <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Your mileage may vary <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
</div>
</div>
<div class="section" id="references">
<h3><a class="toc-backref" href="#id18">7&nbsp;&nbsp;&nbsp;References</a></h3>
<ul class="simple">
<li><a class="reference external" href="http://stackoverflow.com/questions/1072171/how-do-you-remove-an-invalid-remote-branch-reference-from-git">How do you Remove an Invalid Remote Branch Reference from Git? - Stack Overflow</a></li>
<li><a class="reference external" href="http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository">git filter branch - Detach subdirectory into separate Git repository - Stack Overflow</a></li>
<li><a class="reference external" href="http://stackoverflow.com/questions/750172/how-do-i-change-the-author-of-a-commit-in-git">version control - How do I change the author of a commit in git? - Stack Overflow</a></li>
<li><a class="reference external" href="http://help.github.com/removing-sensitive-data/">Help.GitHub - Removing sensitive data</a></li>
<li><a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git filter-branch manpage</a></li>
<li><a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html">git svn manpage</a></li>
</ul>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2011/06/12/396/exporting-code-to-git-and-tiding-up-its-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Teias e mais teias</title>
		<link>http://www.burocrata.org/blog/archives/2011/04/11/393/teias-e-mais-teias/</link>
		<comments>http://www.burocrata.org/blog/archives/2011/04/11/393/teias-e-mais-teias/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 00:14:11 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/?p=393</guid>
		<description><![CDATA[Sim, esse blog está entregue às baratas. Não, não há nada de interessante aqui, exceto que faço 30 anos em 4 dias. Grato.]]></description>
			<content:encoded><![CDATA[<p>Sim, esse blog está entregue às baratas.</p>
<p>Não, não há nada de interessante aqui, exceto que faço <a href="/30anos">30 anos</a> em 4 dias.</p>
<p>Grato.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2011/04/11/393/teias-e-mais-teias/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Private GIT repositories (on DreamHost)</title>
		<link>http://www.burocrata.org/blog/archives/2010/11/08/345/private-git-repositories-on-dreamhost/</link>
		<comments>http://www.burocrata.org/blog/archives/2010/11/08/345/private-git-repositories-on-dreamhost/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 00:58:32 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Nerdocracia]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/?p=345</guid>
		<description><![CDATA[This is yet another guide describing how to setup private HTTP-accessible Git repositories on Dreamhost using Git's git-http-backend (a.k.a git's Smart HTTP protocol). While similar guides can easily be found by the thousands in the Web (I've listed some of them in the Refereces section), I've found that some guides have outdated information or that the setup described in them could be improved. Thus, this guide tries to update, improve and consolidate the information dispersed in such sources.]]></description>
			<content:encoded><![CDATA[<p>This is yet another guide describing how to setup private HTTP-accessible Git repositories on Dreamhost using Git&#8217;s git-http-backend (a.k.a git&#8217;s Smart HTTP protocol). While similar guides can easily be found by the thousands in the Web (I&#8217;ve listed some of them in the Refereces section), I&#8217;ve found that some guides have outdated information or that the setup described in them could be improved. Thus, this guide tries to update, improve and consolidate the information dispersed in such sources.</p>
<p><span id="more-345"></span></p>

<div class="note" style="border: 1px solid black;">
<p class="admonition-title"><strong>Notice:</strong></p>
<p>the original guide is available at <a href="http://github.com/tmacam/private-git-on-dreamhost">http://github.com/tmacam/private-git-on-dreamhost</a>. Nevertheless, its content as on 2010-11-08, is presented bellow.</p></div>

<h3 class="title">Private GIT repositories (on DreamHost)</h3>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>Tiago Alves Macambira</td></tr>
<tr class="field"><th class="docinfo-name">Licence:</th><td class="field-body">Creative Commons By-SA</td>
</tr>
</tbody>
</table>
<div class="contents topic" id="table-of-contents">
<p class="topic-title first">Table of Contents</p>
<ul class="auto-toc simple">
<li><a class="reference internal" href="#introduction" id="id10">1&nbsp;&nbsp;&nbsp;Introduction</a><ul class="auto-toc">
<li><a class="reference internal" href="#assumptions-and-requirements" id="id11">1.1&nbsp;&nbsp;&nbsp;Assumptions and requirements</a></li>
<li><a class="reference internal" href="#about-this-document" id="id12">1.2&nbsp;&nbsp;&nbsp;About this document</a></li>
</ul>
</li>
<li><a class="reference internal" href="#installation" id="id13">2&nbsp;&nbsp;&nbsp;Installation</a><ul class="auto-toc">
<li><a class="reference internal" href="#install-git" id="id14">2.1&nbsp;&nbsp;&nbsp;Install Git</a></li>
<li><a class="reference internal" href="#create-the-directory-where-your-repositories-will-live" id="id15">2.2&nbsp;&nbsp;&nbsp;Create the directory where your repositories will live</a></li>
<li><a class="reference internal" href="#setup-the-bare-repository-creation-script" id="id16">2.3&nbsp;&nbsp;&nbsp;Setup the bare repository creation script</a></li>
<li><a class="reference internal" href="#apache-setup" id="id17">2.4&nbsp;&nbsp;&nbsp;Apache Setup</a><ul class="auto-toc">
<li><a class="reference internal" href="#setup-your-htaccess" id="id18">2.4.1&nbsp;&nbsp;&nbsp;Setup your .htaccess</a></li>
<li><a class="reference internal" href="#setup-git-http-backend-for-your-repositories" id="id19">2.4.2&nbsp;&nbsp;&nbsp;Setup git-http-backend for your repositories</a></li>
<li><a class="reference internal" href="#password-protect-your-repository" id="id20">2.4.3&nbsp;&nbsp;&nbsp;Password-protect your repository</a></li>
<li><a class="reference internal" href="#setup-gitweb" id="id21">2.4.4&nbsp;&nbsp;&nbsp;Setup GitWeb</a><ul class="auto-toc">
<li><a class="reference internal" href="#retrieving-and-installing" id="id22">2.4.4.1&nbsp;&nbsp;&nbsp;Retrieving and installing</a></li>
<li><a class="reference internal" href="#setting-up-gitweb" id="id23">2.4.4.2&nbsp;&nbsp;&nbsp;Setting up GitWeb</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#troubleshooting" id="id24">2.5&nbsp;&nbsp;&nbsp;Troubleshooting</a><ul class="auto-toc">
<li><a class="reference internal" href="#disable-authentication" id="id25">2.5.1&nbsp;&nbsp;&nbsp;Disable authentication</a></li>
<li><a class="reference internal" href="#use-info-cgi-script-to-check-cgi-script-s-environment" id="id26">2.5.2&nbsp;&nbsp;&nbsp;Use info.cgi script to check CGI script's environment</a></li>
<li><a class="reference internal" href="#check-the-server-logs" id="id27">2.5.3&nbsp;&nbsp;&nbsp;Check the server logs</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#usage" id="id28">3&nbsp;&nbsp;&nbsp;Usage</a><ul class="auto-toc">
<li><a class="reference internal" href="#creating-new-bare-repositories" id="id29">3.1&nbsp;&nbsp;&nbsp;Creating new bare repositories</a></li>
<li><a class="reference internal" href="#cloning-an-empty-repository" id="id30">3.2&nbsp;&nbsp;&nbsp;Cloning an empty repository</a></li>
<li><a class="reference internal" href="#pushing-to-a-new-empty-repository" id="id31">3.3&nbsp;&nbsp;&nbsp;Pushing to a new empty repository</a></li>
</ul>
</li>
<li><a class="reference internal" href="#final-remarks" id="id32">4&nbsp;&nbsp;&nbsp;Final remarks</a></li>
<li><a class="reference internal" href="#todos" id="id33">5&nbsp;&nbsp;&nbsp;TODOs</a></li>
<li><a class="reference internal" href="#references" id="id34">6&nbsp;&nbsp;&nbsp;References</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h3><a class="toc-backref" href="#id10">1&nbsp;&nbsp;&nbsp;Introduction</a></h3>
<p>This is <em>yet another</em> guide describing how to setup private
HTTP-accessible Git repositories on <a class="reference external" href="http://www.dreamhost.com">Dreamhost</a> using Git's
<tt class="docutils literal"><span class="pre">git-http-backend</span></tt> (a.k.a git's <a class="reference external" href="http://progit.org/2010/03/04/smart-http.html">Smart HTTP protocol</a>). While
similar guides can easily be found by the thousands in the Web (I've
listed some of them in the Refereces section), I've found that some
guides have outdated information or that the setup described in
them could be improved. Thus, this guide tries to update, improve and
consolidate the information dispersed in such sources.</p>
<p>Some might ask "Why on Earth would someone opt to create its own
private Git hosting solution while better offerings are available from
sites such as, let's say, <a class="reference external" href="http://github.com">GitHub</a>?" As the guy <a class="reference external" href="http://railstips.org/blog/archives/2008/11/23/gitn-your-shared-host-on/">from RailsTips
pointed out in one of his articles</a>, sometimes you don't need or
don't want to "share" a project with anyone but yourself and
paying for a <a class="reference external" href="http://github.com">GitHub</a>-like service might just not make sense.  If
that's your case, than this guide is for you.</p>
<p>While aimed at a <a class="reference external" href="http://www.dreamhost.com">Dreamhost</a>-hosted accounts and the environment such
accounts have as of 2010-10-17, I believe the process described here
can be used in other hosting providers as well.</p>
<p>It is important to highlight that one of the objectives of this guide
is to describe a process that:</p>
<ul class="simple">
<li>should be easy to perform by just renaming or editing this guide's
companion files and</li>
<li>once complete, can be easily be reused to generate other "collection
of repositories", with different URLs and passwords.</li>
</ul>
<div class="section" id="assumptions-and-requirements">
<h4><a class="toc-backref" href="#id11">1.1&nbsp;&nbsp;&nbsp;Assumptions and requirements</a></h4>
<ul>
<li><p class="first">No WebDav or SSH support is needed nor used for serving Git repositories.</p>
<p>Once again, the focus is on HTTP access using
<tt class="docutils literal"><span class="pre">git-http-backend</span></tt>. As for SSH, guides describing how to setup a
similar environment for SSH-accessible repositories can be found
easily on the web.</p>
</li>
<li><p class="first">Repositories will be password protected and available for both
reading and writting.</p>
<p>As we will explain latter, in the <a class="reference internal" href="#setup-git-http-backend-for-your-repositories">Setup git-http-backend for your
repositories</a> section, we will have to password-protect our
repositories in order to be able to <tt class="docutils literal">git push</tt> to them through HTTP.</p>
</li>
<li><p class="first">We will stick to a <a class="reference external" href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a> (Don't Repeat Yourself) philosophy.</p>
<p>Thus, we want configuration options to be repeated in as few places
as possible. We will use environment variables in Apache
configuration files to do this. If this makes you uncomfortable,
well, you can always manually spread configuration options all over
the place. <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Your call.</p>
</li>
<li><p class="first">The web server being used is Apache.</p>
<p>Well, that is what <a class="reference external" href="http://www.dreamhost.com">Dreamhost</a> allows me to use so that is going to
be the focus of this guide. While it should not be that difficult to
port the settings here to something suitable for another web server,
describing how to do it is out of the scope of this guide.</p>
</li>
<li><p class="first">We are able to run CGI scripts.</p>
<p><a class="reference external" href="http://wiki.dreamhost.com/CGI">DreamHosts puts some restrictions</a>
on how a CGI script can be executed and the environment where it
runs. We will abide to those restrictions.</p>
</li>
</ul>
<ul>
<li><p class="first"><tt class="docutils literal">ScriptAlias</tt> is not allowed by the web server.</p>
<p>The instructions given in <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html">git-http-backend</a> manpage will not work as
they use <tt class="docutils literal">ScriptAlias</tt>. The idea is to use common CGI scripts and
<tt class="docutils literal">mod_rewrite</tt> instead, roughly following the ideas presented in
<a class="reference external" href="http://wiki.dreamhost.com/Git#Smart_HTTP">http://wiki.dreamhost.com/Git#Smart_HTTP</a> .</p>
</li>
<li><p class="first"><a class="reference external" href="http://wiki.dreamhost.com/Suexec">SuExec</a> is used to run CGI scripts.</p>
<p>Notice that, as stated in DreamHost page on CGI, <tt class="docutils literal">SuExec</tt> "<em>wipes out all
environment variables that don't start with HTTP_"</em>. All our
env. vars. will have this prefix.</p>
</li>
<li><p class="first">Your private git repositories will be accessible in a subpath of your
domain.</p>
<p>The idea is that your private git repos will be available in an
address such as <strong>http://www.example.tld/corporate-git/</strong>. Adapting
the instructions bellow so you can serve them from the root of a
domain of its own, say <strong>http://corporate-git.example.tld</strong> should
be fairly simple.</p>
</li>
</ul>
</div>
<div class="section" id="about-this-document">
<h4><a class="toc-backref" href="#id12">1.2&nbsp;&nbsp;&nbsp;About this document</a></h4>
<p>This document and its companion files are initially hosted on
<a class="reference external" href="http://github.com/tmacam/private-git-on-dreamhost">http://github.com/tmacam/private-git-on-dreamhost</a>.</p>
<p>The file <tt class="docutils literal">README.rst</tt> is generated from <tt class="docutils literal"><span class="pre">README-real.rst</span></tt>.  So, if
you plan on doing any updates or fixes, <tt class="docutils literal"><span class="pre">README-real.rst</span></tt> is the
file you ought to edit. Just run <tt class="docutils literal">make</tt> afterwards in order to get
<tt class="docutils literal">README.rst</tt> updated as well. This is done because I wanted to use
<a class="reference external" href="http://github.com">GitHub</a>'s automatic rendering of README files but I didn't want to
just paste the contents of the companion files in this <tt class="docutils literal">README.rst</tt>
and risk getting the Guide and files out of sync.  Unfortunately,
GitHub does not allow the use of RestructuredText's <tt class="docutils literal">include</tt>
directive, so I had to fake it -- and here is the reason why we have
<tt class="docutils literal"><span class="pre">README-real.rst</span></tt>.</p>
<p>This guide is distributed under the Creative Common BY-SA license while
companion files are distributed under a MIT License.</p>
</div>
</div>
<div class="section" id="installation">
<h3><a class="toc-backref" href="#id13">2&nbsp;&nbsp;&nbsp;Installation</a></h3>
<p>All the commands and instructions given bellow should be performed on
the machine in Dreamhost where your account is installed. So ssh to it
and let's start.</p>
<div class="section" id="install-git">
<h4><a class="toc-backref" href="#id14">2.1&nbsp;&nbsp;&nbsp;Install Git</a></h4>
<p>Well, this should probably be a non-issue since git comes
pre-installed on most Dreamhost machines. To verify it:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #660033;">--version</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> version 1.7.1.1</pre></div></div>



<p>As you see, the box that serves my domain in dreamhost has git version
1.7.1.1 installed. <a class="reference external" href="http://progit.org/2010/03/04/smart-http.html">Anything greater than 1.6.6 shall do</a>.</p>
<p>If you don't have git installed in you box, have an old version or if
for some other reason your need to compile git, follow Craig's instructions in
<a class="reference external" href="http://craigjolicoeur.com/blog/hosting-git-repositories-on-dreamhost">Hosting Git Repositories on Dreamhost</a>.</p>
</div>
<div class="section" id="create-the-directory-where-your-repositories-will-live">
<h4><a class="toc-backref" href="#id15">2.2&nbsp;&nbsp;&nbsp;Create the directory where your repositories will live</a></h4>
<p>It should reside somewhere not accessible from the web or directly
served by the web server. We will tell Apache and <tt class="docutils literal"><span class="pre">git-http-backend</span></tt>
how to properly and securely serve those repositories latter. For now,
we want them protected from third parties.</p>
<p>Say we decided to store them in <tt class="docutils literal">~/private_repos/</tt>. We will refer to
this directly by <tt class="docutils literal">GIT_REPOS_ROOT</tt> in the rest of this guide. Create
this directory and protect it against filesystem access from others:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GIT_REPOS_ROOT</span>=<span style="color: #ff0000;">&quot;~/private_repos/&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #800000;">${GIT_REPOS_ROOT}</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">711</span> <span style="color: #800000;">${GIT_REPOS_ROOT}</span></pre></div></div>



</div>
<div class="section" id="setup-the-bare-repository-creation-script">
<h4><a class="toc-backref" href="#id16">2.3&nbsp;&nbsp;&nbsp;Setup the bare repository creation script</a></h4>
<p>We will use the script <tt class="docutils literal">newgit.sh</tt>, presented bellow, to create new
repositories <a class="footnote-reference" href="#id7" id="id5">[1]</a> <a class="footnote-reference" href="#id8" id="id6">[2]</a> . Remember to modify
the value of the GIT_REPOS_ROOT variable in it to match our setup:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># this script is based on code from the following blog post</span>
<span style="color: #666666; font-style: italic;"># http://arvinderkang.com/2010/08/25/hosting-git-repositories-on-dreamhost/</span>
<span style="color: #666666; font-style: italic;"># and http://gist.github.com/73622</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-e</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># Please, configure a default GIT_REPOS_ROOT to match your config</span>
<span style="color: #666666; font-style: italic;">#GIT_REPOS_ROOT=&quot;~/private_repos/&quot;</span>
&nbsp;
<span style="color: #007800;">DEFAULT_DESCRIPTION</span>=<span style="color: #ff0000;">'no description :('</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># describe how the script works</span>
usage<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 [ -h ] [ -r directory] [ -d description ] [ -n projectname ]&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;If no projectname is given, the name of the parent folder will be used as project name.&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;  -r directory   : (root) directory holding your git repositories&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;  -d description : description for gitweb&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;  -h             : print this screen&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;  -n name        : name of the project (should end in .git)&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #007800;">DESCRIPTION</span>=<span style="color: #800000;">${DEFAULT_DESCRIPTION}</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># evaluate the options passed on the command line</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">getopts</span> r:d:n:h option
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${option}</span>&quot;</span>
  <span style="color: #000000; font-weight: bold;">in</span>
    r<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">GIT_REPOS_ROOT</span>=<span style="color: #800000;">${OPTARG}</span><span style="color: #000000; font-weight: bold;">;;</span>
    d<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">DESCRIPTION</span>=<span style="color: #800000;">${OPTARG}</span><span style="color: #000000; font-weight: bold;">;;</span>
    n<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">REPONAME</span>=<span style="color: #800000;">${OPTARG}</span><span style="color: #000000; font-weight: bold;">;;</span>
    h<span style="color: #7a0874; font-weight: bold;">&#41;</span> usage
      <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">;;</span>
  <span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># check if repositories directory is given and is accessible</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$GIT_REPOS_ROOT</span>  <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    usage
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$GIT_REPOS_ROOT</span>  <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ERROR: '<span style="color: #007800;">${GIT_REPOS_ROOT}</span>' is not a directory&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
    usage
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># check if name of repository is given. if not, use folder name</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$REPONAME</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #007800;">REPONAME</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$PWD</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Add .git at and if needed</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$REPONAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-q</span> <span style="color: #ff0000;">'\.git$'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #007800;">REPONAME</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${REPONAME}</span>.git&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Ready to go</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
&nbsp;
<span style="color: #007800;">REP_DIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${GIT_REPOS_ROOT}</span>/<span style="color: #007800;">${REPONAME}</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #800000;">${REP_DIR}</span>
<span style="color: #7a0874; font-weight: bold;">pushd</span> <span style="color: #800000;">${REP_DIR}</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #660033;">--bare</span> init
<span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #660033;">--bare</span> update-server-info
<span style="color: #c20cb9; font-weight: bold;">cp</span> hooks<span style="color: #000000; font-weight: bold;">/</span>post-update.sample hooks<span style="color: #000000; font-weight: bold;">/</span>post-update
<span style="color: #c20cb9; font-weight: bold;">chmod</span> a+x hooks<span style="color: #000000; font-weight: bold;">/</span>post-update
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$DESCRIPTION</span> <span style="color: #000000; font-weight: bold;">&gt;</span> description
<span style="color: #666666; font-style: italic;"># This mark the repository as exportable.</span>
<span style="color: #666666; font-style: italic;"># For more info refer to git-http-backend manpage</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> git-daemon-export-ok
<span style="color: #7a0874; font-weight: bold;">popd</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>



<p>Move or copy this file to an appropriate path (say, your home
directory would be fine) and turn it into an executable:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> u+x ~<span style="color: #000000; font-weight: bold;">/</span>newgit.sh</pre></div></div>



<table class="docutils footnote" frame="void" id="id7" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id5">[1]</a></td><td>This script is based in <a class="reference external" href="http://gist.github.com/73622">http://gist.github.com/73622</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id6">[2]</a></td><td>Other guides prefer to use something similar wrapped as a Bash
function but I'd rather have it as a script</td></tr>
</tbody>
</table>
</div>
<div class="section" id="apache-setup">
<h4><a class="toc-backref" href="#id17">2.4&nbsp;&nbsp;&nbsp;Apache Setup</a></h4>
<p>Now, let's configure Apache to securely serve those repositories.</p>
<div class="section" id="setup-your-htaccess">
<h5><a class="toc-backref" href="#id18">2.4.1&nbsp;&nbsp;&nbsp;Setup your .htaccess</a></h5>
<p>As we stated in <a class="reference internal" href="#assumptions-and-requirements">Assumptions and requirements</a>, we want to serve our files from
<strong>http://www.example.tld/corporate-git/</strong>. So, go to the directory
holding your domain files (<tt class="docutils literal">~/www.example.tld</tt>, in our exemple),
create a <tt class="docutils literal"><span class="pre">corporate-git</span></tt> directory in it if it doesn't exist yet and create
a <tt class="docutils literal">.htaccess</tt> file in it:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>www.example.tld
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> corporate-git
<span style="color: #7a0874; font-weight: bold;">cd</span> corporate-git
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GIT_WEB_DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #666666; font-style: italic;"># we will use it in latter steps</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> .htaccess
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">644</span> .htaccess</pre></div></div>



<p>Now, edit this <tt class="docutils literal">.htaccess</tt> contents to match the text presented
bellow or just copy the contents of the file <tt class="docutils literal"><span class="pre">model-htaccess</span></tt> into
it and adapt it to match your config:</p>


<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">Options</span> +<span style="color: #0000ff;">Indexes</span>
&nbsp;
<span style="color: #adadad; font-style: italic;"># GIT BEGIN ###########################################################</span>
&nbsp;
<span style="color: #00007f;">SetEnv</span> HTTP_GIT_PROJECT_ROOT /home/<span style="color: #00007f;">user</span>/private_repos/
<span style="color: #00007f;">SetEnv</span> HTTP_GITWEB_CONFIG /home/<span style="color: #00007f;">user</span>/private_repos/gitweb_config.perl
&nbsp;
&nbsp;
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">DirectoryIndex</span>  gitweb_wrapper.cgi
<span style="color: #adadad; font-style: italic;"># The following two rules can be used instead of DirectoryIndex</span>
<span style="color: #adadad; font-style: italic;">#RewriteRule ^$  gitweb_wrapper.cgi/ [L,E=SCRIPT_URL:/$1]</span>
<span style="color: #adadad; font-style: italic;">#RewriteRule ^([?].*)$ gitweb_wrapper.cgi/ [L,E=SCRIPT_URL:/$1]</span>
&nbsp;
<span style="color: #adadad; font-style: italic;"># Everything else that is not a file is forwarded to git-http-backend</span>
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} !-f
<span style="color: #00007f;">RewriteRule</span> ^([^?].+)$ git-http-backend-private.cgi/$1
&nbsp;
&nbsp;
<span style="color: #adadad; font-style: italic;"># GIT END ############################################################</span>
&nbsp;
<span style="color: #adadad; font-style: italic;"># AUTHENTICATION BEGIN ###############################################</span>
<span style="color: #00007f;">AuthType</span> Digest
<span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;Private Git Repository Access&quot;</span>
<span style="color: #adadad; font-style: italic;"># UNCOMMENT THE LINE BELLOW FOR BETTER PERFORMANCE</span>
<span style="color: #adadad; font-style: italic;"># AuthDigestDomain /corporate-git/</span>
<span style="color: #00007f;">AuthUserFile</span> /home/<span style="color: #00007f;">user</span>/private_repos/.htpasswd
<span style="color: #00007f;">Require</span> valid-<span style="color: #00007f;">user</span>
<span style="color: #adadad; font-style: italic;"># AUTHENTICATION END  ################################################</span></pre></div></div>



<p>For now we will focus on the area between the <tt class="docutils literal"># GIT BEGIN</tt> and <tt class="docutils literal">#
GIT END</tt> blocks.  Modify <tt class="docutils literal">HTTP_GIT_PROJECT_ROOT</tt> to match you setup:
it should point to the <strong>full path</strong> where you store your private
repositories. Just expand the value of <tt class="docutils literal">GIT_REPOS_ROOT</tt> to get this
information:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #800000;">${GIT_REPOS_ROOT}</span>; <span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>private_repos<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>



<p>So, in our example, <tt class="docutils literal">HTTP_GIT_PROJECT_ROOT</tt> value should be set to
<tt class="docutils literal">/home/user/private_repos/</tt>, as presented in the example above.</p>
</div>
<div class="section" id="setup-git-http-backend-for-your-repositories">
<h5><a class="toc-backref" href="#id19">2.4.2&nbsp;&nbsp;&nbsp;Setup git-http-backend for your repositories</a></h5>
<p>Not we will create a CGI script that will invoke
<tt class="docutils literal"><span class="pre">git-http-backend</span></tt>. In your <tt class="docutils literal">.htaccess</tt> this script is referred as
<tt class="docutils literal"><span class="pre">git-http-backend-private.cgi</span></tt>. Create it in the same directory
where you <tt class="docutils literal">.htaccess</tt> is by coping the one that comes with this guide
to that directory or by creating an empty file with the following
contents:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GIT_HTTP_EXPORT_ALL</span>=<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GIT_PROJECT_ROOT</span>=<span style="color: #800000;">${HTTP_GIT_PROJECT_ROOT:?HTTP_GIT_PROJECT_ROOT env. variable not set. Aborting.}</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>git-core<span style="color: #000000; font-weight: bold;">/</span>git-http-backend</pre></div></div>



<p>Turn it into an executable file:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> git-http-backend-private.cgi</pre></div></div>



<div class="attention">
<p class="first admonition-title">Attention!</p>
<p class="last">You may need to update the path to <tt class="docutils literal"><span class="pre">git-http-backend</span></tt> executable
if git was installed in a non-default location.</p>
</div>
<p>And that's it. No need to setup anything: all the settings this
scripts are passed to it through environment variables set by Apache
and defined in the <tt class="docutils literal">.htaccess</tt> file.</p>
<p>From this point on you should be able to create repositories from the
command line and
access them through HTTP, but they will be
<strong>read-only</strong>. As stated in <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html">git-http-backend</a> manpage, "<em>by default,
only the ``upload-pack`` service is enabled, which serves git ``fetch-pack``
and git ls-remote clients, which are invoked from ``git fetch``, ``git pull``,
and ``git clone``</em>". For <strong>write access</strong>, i.e., to be able to perform a
<tt class="docutils literal">git push</tt>, the <tt class="docutils literal"><span class="pre">receive-pack</span></tt> service is needed, and it <strong>is only
enabled when the client is authenticated</strong>.</p>
</div>
<div class="section" id="password-protect-your-repository">
<h5><a class="toc-backref" href="#id20">2.4.3&nbsp;&nbsp;&nbsp;Password-protect your repository</a></h5>
<p>We are almost set. Let's configure password protection for this whole
thing.  We will focus on the latter part of your <tt class="docutils literal">.htaccess</tt>, the one
between <tt class="docutils literal"># AUTHENTICATION BEGIN</tt> and <tt class="docutils literal"># AUTHENTICATION END</tt> that we
reproduce bellow:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># AUTHENTICATION BEGIN ########################</span>
AuthType Digest
AuthName <span style="color: #ff0000;">&quot;Private Git Repository Access&quot;</span>
AuthUserFile <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>private_repos<span style="color: #000000; font-weight: bold;">/</span>.htpasswd
Require valid-user
<span style="color: #666666; font-style: italic;"># AUTHENTICATION END  #########################</span></pre></div></div>



<p>You will have to create the password file pointed by <tt class="docutils literal">AuthUserFile</tt>
and use the <tt class="docutils literal">htdigest</tt> tool to add a user to this file</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>private_repos<span style="color: #000000; font-weight: bold;">/</span>.htpasswd
htdigest <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>user<span style="color: #000000; font-weight: bold;">/</span>private_repos<span style="color: #000000; font-weight: bold;">/</span>.htpasswd <span style="color: #ff0000;">&quot;Private Git Repository Access&quot;</span> username</pre></div></div>



<p>You will be prompted for a password. And that's it.</p>
<p>Notice:</p>
<ul class="simple">
<li>we are using <a class="reference external" href="http://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html#using">Digest Authentication</a>. It
is supposed to be more secure than plain authentication.</li>
<li>The password file should be keep in a place not directly accessible
from the web. Ideally it should not even be placed in the directory
to be served by <tt class="docutils literal"><span class="pre">git-http-backend</span></tt> but I'm lazy and I hope this
will be enough. <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>If you update the value of the <tt class="docutils literal">AuthName</tt> setting you <strong>must</strong>
also change the 2nd. parameter passed to <tt class="docutils literal">htdigest</tt>, i.e., the
<em>Realm</em>, as <a class="reference external" href="http://www.freebsdwiki.net/index.php/Apache,_Digest_Authentication">they must match</a>!
Odd, I know. But that's the way it is.</li>
</ul>
</div>
<div class="section" id="setup-gitweb">
<h5><a class="toc-backref" href="#id21">2.4.4&nbsp;&nbsp;&nbsp;Setup GitWeb</a></h5>
<p>If you followed this guide up to this point than you are able to use
your repositories with git with no major issues. But you will not be
able to browse them with a web browser, retrieve the list of
repositories you have, see diffs, commit messages nor nothing like
that. To make things better, let's install GitWeb, another CGI
interface that will provide a web interface that allows to do all
those things I just said you couldn't.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">Most of the content in this section comes from  Kang's <a class="reference external" href="http://arvinderkang.com/2010/08/25/hosting-git-repositories-on-dreamhost/">Hosting Git repositories on Dreamhost</a>.</p>
</div>
<div class="section" id="retrieving-and-installing">
<h6><a class="toc-backref" href="#id22">2.4.4.1&nbsp;&nbsp;&nbsp;Retrieving and installing</a></h6>
<p>GitWeb comes in the same source package as git itself. Unfortunately,
Dreamhost doesn't install it by default so we will have to install it
manually ourselves. Do your remember what is your git version? No?
Find it all:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #660033;">--version</span></pre></div></div>



<p>Go to <a class="reference external" href="http://git-scm.com/">git homepage</a> and download the corresponding source
package. In my example, in which my git version is 1.7.1.1, I would
need to grab the <tt class="docutils literal"><span class="pre">git-1.7.1.1.tar.gz</span></tt> source package:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~ <span style="color: #666666; font-style: italic;"># Yep, we will download it in our home directory</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.kernel.org<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>software<span style="color: #000000; font-weight: bold;">/</span>scm<span style="color: #000000; font-weight: bold;">/</span>git<span style="color: #000000; font-weight: bold;">/</span>git-1.7.1.1.tar.gz</pre></div></div>



<p>Unpack it, build GitWeb:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf git-1.7.1.1.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> git-1.7.1.1
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin gitweb<span style="color: #000000; font-weight: bold;">/</span>gitweb.cgi
<span style="color: #c20cb9; font-weight: bold;">rm</span> gitweb<span style="color: #000000; font-weight: bold;">/</span>gitweb.perl <span style="color: #666666; font-style: italic;"># we won't need it</span></pre></div></div>



<p>We will install it into <tt class="docutils literal">~/gitweb/</tt>:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GITWEB_INSTALL_DIR</span>=<span style="color: #ff0000;">&quot;~/gitweb&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-r</span> gitweb <span style="color: #800000;">${GITWEB_INSTALL_DIR}</span></pre></div></div>



<p>We are almost there.</p>
</div>
<div class="section" id="setting-up-gitweb">
<h6><a class="toc-backref" href="#id23">2.4.4.2&nbsp;&nbsp;&nbsp;Setting up GitWeb</a></h6>
<p>Now, copy all the GitWeb's media files into the directory
where your <tt class="docutils literal">.htaccess</tt> is:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #800000;">${GITWEB_INSTALL_DIR}</span><span style="color: #000000; font-weight: bold;">/*</span>.<span style="color: #7a0874; font-weight: bold;">&#123;</span>css,png,js<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #800000;">${GIT_WEB_DIR}</span>
<span style="color: #666666; font-style: italic;"># in this example, GIT_WEB_DIR points</span>
<span style="color: #666666; font-style: italic;"># to ~/www.example.tld/corporate-git</span></pre></div></div>



<p>Get back to where your <tt class="docutils literal">.htaccess</tt> file is
(i.e. <tt class="docutils literal">GIT_WEB_DIR</tt>). We will create a wrapper CGI for
GitWeb. Just copy <tt class="docutils literal">gitweb_wrapper.cgi</tt> or create an empty file with
the contents bellow:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GITWEB_CONFIG</span>=<span style="color: #800000;">${HTTP_GITWEB_CONFIG:?HTTP_GITWEB_CONFIG env. variable not set. Aborting.}</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GIT_PROJECT_ROOT</span>=<span style="color: #800000;">${HTTP_GIT_PROJECT_ROOT:?HTTP_GIT_PROJECT_ROOT env. variable not set. Aborting.}</span>
&nbsp;
<span style="color: #800000;">${HOME}</span><span style="color: #000000; font-weight: bold;">/</span>gitweb<span style="color: #000000; font-weight: bold;">/</span>gitweb.cgi</pre></div></div>



<p>Turn it into an executable file:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> gitweb_wrapper.cgi</pre></div></div>



<div class="attention">
<p class="first admonition-title">Attention!</p>
<p class="last">If you have installed gitweb files in a different directory, you
will have to update this file to match the install location.</p>
</div>
<p>Once again, we are using settings stored in <tt class="docutils literal">.htaccess</tt> file and
passing them to a script using environment variables set by Apache. In
this case, we are informing the wrapper script where our repositories
are with <tt class="docutils literal">HTTP_GIT_PROJECT_ROOT</tt>, and informing it where GitWeb
configuration file is with <tt class="docutils literal">HTTP_GITWEB_CONFIG</tt>. The wrapper script,
in turn, will forward these informations to both GitWeb and to its
config file.</p>
<p>Now, let's create GitWeb configuration file. Just
copy <tt class="docutils literal">gitweb_config.perl</tt> provided with this guide to
<tt class="docutils literal"><span class="pre">${GIT_REPOS_ROOT}/gitweb_config.perl</span></tt> or create an empty file in
that path location with the following contents:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># where is the git binary?</span>
<span style="color: #007800;">$GIT</span> = <span style="color: #ff0000;">&quot;/usr/bin/git&quot;</span>;
<span style="color: #666666; font-style: italic;"># where are our git project repositories?</span>
<span style="color: #007800;">$projectroot</span> = <span style="color: #007800;">$ENV</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">'GIT_PROJECT_ROOT'</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>;
<span style="color: #666666; font-style: italic;"># what do we call our projects in the gitweb UI?</span>
<span style="color: #007800;">$home_link_str</span> = <span style="color: #ff0000;">&quot;My Git Projects&quot;</span>;
<span style="color: #666666; font-style: italic;">#  where are the files we need for gitweb to display?</span>
<span style="color: #000000; font-weight: bold;">@</span>stylesheets = <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;gitweb.css&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #007800;">$logo</span> = <span style="color: #ff0000;">&quot;git-logo.png&quot;</span>;
<span style="color: #007800;">$favicon</span> = <span style="color: #ff0000;">&quot;/favicon.png&quot;</span>;
<span style="color: #666666; font-style: italic;"># what do we call this site?</span>
<span style="color: #007800;">$site_name</span> = <span style="color: #ff0000;">&quot;My Personal Git Repositories&quot;</span>;</pre></div></div>



<p>You can customize it a little bit, if you want, but the most important
setting, <tt class="docutils literal">$projectroot</tt>, is set to match the value of
<tt class="docutils literal">HTTP_GIT_PROJECT_ROOT</tt>, a env. var. set by Apache.</p>
<p>Notice that this file, <tt class="docutils literal">gitweb_config.perl</tt> is stored in the same
directory where your repositories are, in <tt class="docutils literal">${GIT_REPOS_ROOT}</tt>. If,
for some reason, you prefer to store it elsewhere, you will have to
update this information in the <tt class="docutils literal">.htaccess</tt> file.</p>
</div>
</div>
</div>
<div class="section" id="troubleshooting">
<h4><a class="toc-backref" href="#id24">2.5&nbsp;&nbsp;&nbsp;Troubleshooting</a></h4>
<p>So, something is not working as expected?</p>
<div class="section" id="disable-authentication">
<h5><a class="toc-backref" href="#id25">2.5.1&nbsp;&nbsp;&nbsp;Disable authentication</a></h5>
<p>Comment out the authentication code. This will ease your "debugging"
process.</p>
<p>Remember to uncomment it latter.</p>
</div>
<div class="section" id="use-info-cgi-script-to-check-cgi-script-s-environment">
<h5><a class="toc-backref" href="#id26">2.5.2&nbsp;&nbsp;&nbsp;Use info.cgi script to check CGI script's environment</a></h5>
<p>A nice way to check if there is something really wrong with your setup
is to use the <tt class="docutils literal">info.cgi</tt>, whose code is presented bellow. This
script is only a minor modification to the one presented in <a class="reference external" href="http://wiki.dreamhost.com/CGI">Dreamhost
wiki page on CGI</a> and allows your to do verify if you are able to
execute CGI scrips and what settings Apache is passing to the other
CGI scripts we use here.</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># disable filename globbing</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-f</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Content-type: text/plain; charset=iso-8859-1&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> CGI<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.0</span> <span style="color: #7a0874; font-weight: bold;">test</span> script report:
<span style="color: #7a0874; font-weight: bold;">echo</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> argc is <span style="color: #007800;">$#</span>. argv is <span style="color: #ff0000;">&quot;$*&quot;</span>.
<span style="color: #7a0874; font-weight: bold;">echo</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> SERVER_SOFTWARE = <span style="color: #007800;">$SERVER_SOFTWARE</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> SERVER_NAME = <span style="color: #007800;">$SERVER_NAME</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> GATEWAY_INTERFACE = <span style="color: #007800;">$GATEWAY_INTERFACE</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> SERVER_PROTOCOL = <span style="color: #007800;">$SERVER_PROTOCOL</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> SERVER_PORT = <span style="color: #007800;">$SERVER_PORT</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> REQUEST_METHOD = <span style="color: #007800;">$REQUEST_METHOD</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> HTTP_ACCEPT = <span style="color: #ff0000;">&quot;<span style="color: #007800;">$HTTP_ACCEPT</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> PATH_INFO = <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PATH_INFO</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> PATH_TRANSLATED = <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PATH_TRANSLATED</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> SCRIPT_NAME = <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SCRIPT_NAME</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> QUERY_STRING = <span style="color: #ff0000;">&quot;<span style="color: #007800;">$QUERY_STRING</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> REMOTE_HOST = <span style="color: #007800;">$REMOTE_HOST</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> REMOTE_ADDR = <span style="color: #007800;">$REMOTE_ADDR</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> REMOTE_USER = <span style="color: #007800;">$REMOTE_USER</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> AUTH_TYPE = <span style="color: #007800;">$AUTH_TYPE</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> CONTENT_TYPE = <span style="color: #007800;">$CONTENT_TYPE</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> CONTENT_LENGTH = <span style="color: #007800;">$CONTENT_LENGTH</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> HTTP_GIT_PROJECT_ROOT = <span style="color: #007800;">$HTTP_GIT_PROJECT_ROOT</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> HTTP_GITWEB_CONFIG = <span style="color: #007800;">$HTTP_GITWEB_CONFIG</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>



<p>Copy it to <tt class="docutils literal">GIT_WEB_DIR</tt>, turn it into an executable script
(<tt class="docutils literal">chmod 755 ...</tt>) and point your browser to it ( That would be
<tt class="docutils literal"><span class="pre">http://www.example.tld/corporate-git/</span></tt> in our example).</p>
</div>
<div class="section" id="check-the-server-logs">
<h5><a class="toc-backref" href="#id27">2.5.3&nbsp;&nbsp;&nbsp;Check the server logs</a></h5>
<p>We are listing this as a last step but that's probably the fist place
where you should have looked for clues: your server logs.</p>
<p>For example:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>Mon Oct <span style="color: #000000;">25</span> <span style="color: #000000;">18</span>:<span style="color: #000000;">30</span>:<span style="color: #000000;">28</span> <span style="color: #000000;">2010</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>error<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>client 150.164.3.192<span style="color: #7a0874; font-weight: bold;">&#93;</span> Service not enabled: <span style="color: #ff0000;">'receive-pack'</span></pre></div></div>



<p>This message says that 'receive-pack' was not enable -- probably
because you are trying to push to a repository and authentication was
disabled. As we explained in <a class="reference internal" href="#setup-git-http-backend-for-your-repositories">Setup git-http-backend for your
repositories</a>, you <strong>must</strong> use authentication to be able to write
(<em>push</em>) to repositories using git-http-backend.</p>
<p>This one should be pretty obvious:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Digest: user username: password mismatch: <span style="color: #000000; font-weight: bold;">/</span>corporate-git<span style="color: #000000; font-weight: bold;">/</span>test.git<span style="color: #000000; font-weight: bold;">/</span>info<span style="color: #000000; font-weight: bold;">/</span>refs</pre></div></div>



<p>And so on...</p>
</div>
</div>
</div>
<div class="section" id="usage">
<h3><a class="toc-backref" href="#id28">3&nbsp;&nbsp;&nbsp;Usage</a></h3>
<p>So everything is ready to use. How do you actually create and use
these new repositories?</p>
<div class="section" id="creating-new-bare-repositories">
<h4><a class="toc-backref" href="#id29">3.1&nbsp;&nbsp;&nbsp;Creating new bare repositories</a></h4>
<p>In order to create a new repository, say <tt class="docutils literal">toyproject.git</tt>, all you
have to do is ssh into your Dreamhost account and:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>newgit.sh <span style="color: #660033;">-r</span> <span style="color: #800000;">${GIT_REPOS_ROOT}</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;My first private repository&quot;</span> <span style="color: #660033;">-n</span> toyproject</pre></div></div>



<p>That's it: your created and empty repository in you repository
collection. You can <em>clone</em> it if you want.</p>
</div>
<div class="section" id="cloning-an-empty-repository">
<h4><a class="toc-backref" href="#id30">3.2&nbsp;&nbsp;&nbsp;Cloning an empty repository</a></h4>
<p>So, you got a new pristine and empty repository. Let's <em>clone</em> it, shall we?:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">git</span> clone http:<span style="color: #000000; font-weight: bold;">//</span>username<span style="color: #000000; font-weight: bold;">@</span>www.example.tld<span style="color: #000000; font-weight: bold;">/</span>corporate-git<span style="color: #000000; font-weight: bold;">/</span>toyproject.git
Initialized empty Git repository <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>teste<span style="color: #000000; font-weight: bold;">/</span>.git<span style="color: #000000; font-weight: bold;">/</span>
Password:
warning: You appear to have cloned an empty repository.</pre></div></div>



<div class="important">
<p class="first admonition-title">Important</p>
<p>Have you noticed that we have a <tt class="docutils literal">username@</tt> in the URL? This
tells git that it must athenticate to the server before trying to
access the git repository.</p>
<p class="last">In this example, we are acessing the
repository with the crentials of the user <tt class="docutils literal">username</tt>, the one we
setup in <a class="reference internal" href="#password-protect-your-repository">Password-protect your repository</a>. Modify it to match
the user you created in that step.</p>
</div>
<p>But what if you already have a local repository and all you want is
push it and its history to the server?</p>
</div>
<div class="section" id="pushing-to-a-new-empty-repository">
<h4><a class="toc-backref" href="#id31">3.3&nbsp;&nbsp;&nbsp;Pushing to a new empty repository</a></h4>
<p>What you usually do is creating a local repository, adding file to it and committing this repository history to the new, empty and pristine repository in your web server:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> toyproject
<span style="color: #7a0874; font-weight: bold;">cd</span> toyproject
<span style="color: #c20cb9; font-weight: bold;">git</span> init
<span style="color: #c20cb9; font-weight: bold;">touch</span> README
<span style="color: #c20cb9; font-weight: bold;">git</span> add README
<span style="color: #c20cb9; font-weight: bold;">git</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'first commit'</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> remote add origin http:<span style="color: #000000; font-weight: bold;">//</span>username<span style="color: #000000; font-weight: bold;">@</span>www.example.tld<span style="color: #000000; font-weight: bold;">/</span>corporate-git<span style="color: #000000; font-weight: bold;">/</span>toyproject.git
<span style="color: #c20cb9; font-weight: bold;">git</span> push origin master</pre></div></div>



<p>If you have an existing Git Repo, that's the procedure:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> existing_toyproject_git_repo
<span style="color: #c20cb9; font-weight: bold;">git</span> remote add origin http:<span style="color: #000000; font-weight: bold;">//</span>username<span style="color: #000000; font-weight: bold;">@</span>www.example.tld<span style="color: #000000; font-weight: bold;">/</span>corporate-git<span style="color: #000000; font-weight: bold;">/</span>toyproject.git
<span style="color: #c20cb9; font-weight: bold;">git</span> push origin master</pre></div></div>



<p>The above workflow follows what is presented in <a class="reference external" href="http://help.github.com/creating-a-repo/">http://help.github.com/creating-a-repo/</a>.</p>
</div>
</div>
<div class="section" id="final-remarks">
<h3><a class="toc-backref" href="#id32">4&nbsp;&nbsp;&nbsp;Final remarks</a></h3>
<p>If you need more than one collection of private repositories (say, one
for you and one to share privately with a group of coworkers), all you
need to do is:</p>
<blockquote>
<ol class="arabic simple">
<li>Create a directory for each of these collections.</li>
<li>Create copies of <tt class="docutils literal">newgit.sh</tt>, one for each collection, and setup
the value of GIT_REPOS_ROOT in each of them.</li>
<li>Adapt each .htaccess accordingly.</li>
<li>GitWeb: copy its files too.. Or just sym-link it from a pristine copy.</li>
</ol>
</blockquote>
</div>
<div class="section" id="todos">
<h3><a class="toc-backref" href="#id33">5&nbsp;&nbsp;&nbsp;TODOs</a></h3>
<ul class="simple">
<li>Focus on reusability.</li>
<li>Write the <a class="reference internal" href="#final-remarks">Final remarks</a> section properly.</li>
</ul>
<p><a class="reference external" href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond">http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond</a> --
serve directly w/ apache if...</p>
<p>Adding project .description directly in the scripts</p>
</div>
<div class="section" id="references">
<h3><a class="toc-backref" href="#id34">6&nbsp;&nbsp;&nbsp;References</a></h3>
<ul class="simple">
<li>arvinderkang.com - <a class="reference external" href="http://arvinderkang.com/2010/08/25/hosting-git-repositories-on-dreamhost/">Hosting Git repositories on Dreamhost</a></li>
<li>craigjolicoeur.com - <a class="reference external" href="http://craigjolicoeur.com/blog/hosting-git-repositories-on-dreamhost">Hosting Git Repositories on Dreamhost</a></li>
<li><a class="reference external" href="http://railstips.org/blog/archives/2008/11/23/gitn-your-shared-host-on/">Git'n Your Shared Host On</a></li>
<li><a class="reference external" href="http://faves.eapen.in/guide-to-hosting-git-repositories-on-dreamhos">http://faves.eapen.in/guide-to-hosting-git-repositories-on-dreamhos</a></li>
<li><a class="reference external" href="http://gist.github.com/73622">http://gist.github.com/73622</a></li>
<li><a class="reference external" href="http://wiki.dreamhost.com/Git#Smart_HTTP">http://wiki.dreamhost.com/Git#Smart_HTTP</a></li>
<li><a class="reference external" href="http://arvinderkang.com/2010/08/25/hosting-git-repositories-on-dreamhost/">http://arvinderkang.com/2010/08/25/hosting-git-repositories-on-dreamhost/</a></li>
<li><a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html">git-http-backend</a> manpage</li>
<li><a class="reference external" href="http://progit.org/2010/03/04/smart-http.html">Pro Git - Smart HTTP Transport</a></li>
<li><a class="reference external" 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></li>
<li><a class="reference external" href="http://help.github.com/creating-a-repo/">http://help.github.com/creating-a-repo/</a></li>
</ul>
<!-- .. target-notes:: -->
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2010/11/08/345/private-git-repositories-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dia do Blog</title>
		<link>http://www.burocrata.org/blog/archives/2010/08/31/340/dia-do-blog/</link>
		<comments>http://www.burocrata.org/blog/archives/2010/08/31/340/dia-do-blog/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 15:38:49 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/?p=340</guid>
		<description><![CDATA[Bom, disseram por aí que hoje é o dia do blog. Aproveitando a deixa, mando o link para uma matéria entitulada &#8220;Como ser índo&#8221; do EpicShit, o blog recomendado de hoje.]]></description>
			<content:encoded><![CDATA[<p>Bom, <a href="http://twitter.com/malvados/status/22617001181">disseram por aí </a>que hoje é o<a href="http://pt.wikipedia.org/wiki/Dia_do_Blog"> dia do blog</a>. Aproveitando a deixa, mando o link para uma matéria entitulada &#8220;<a href="http://www.epicshit.com.br/2010/08/27/como-ser-indio/">Como ser índo</a>&#8221; do <a href="http://www.epicshit.com.br">EpicShit</a>, o blog recomendado de hoje.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2010/08/31/340/dia-do-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exercícios e Músicas</title>
		<link>http://www.burocrata.org/blog/archives/2005/11/24/241/exercicios-e-musicas/</link>
		<comments>http://www.burocrata.org/blog/archives/2005/11/24/241/exercicios-e-musicas/#comments</comments>
		<pubDate>Thu, 24 Nov 2005 15:26:20 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/archives/2005/11/24/241/exercicios-e-musicas/</guid>
		<description><![CDATA[Tirar a poeira do blog e dizer que se exercitar escutando música melhora a sua capacidade mental, dizem os especialistas. E é isso ai The Strokes &#8211; I Can&#8217;t Win]]></description>
			<content:encoded><![CDATA[<p>Tirar a poeira do blog e dizer que <a href="http://researchnews.osu.edu/archive/hartsong.htm">se exercitar escutando música melhora a sua capacidade mental</a>, dizem os especialistas.</p>
<p>E é isso ai <img src='http://www.burocrata.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="listening">The Strokes &#8211; I Can&#8217;t Win</div>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2005/11/24/241/exercicios-e-musicas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filosofia de Bar</title>
		<link>http://www.burocrata.org/blog/archives/2005/09/21/234/filosofia-de-bar/</link>
		<comments>http://www.burocrata.org/blog/archives/2005/09/21/234/filosofia-de-bar/#comments</comments>
		<pubDate>Wed, 21 Sep 2005 21:07:59 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/archives/2005/09/21/234/filosofia-de-bar/</guid>
		<description><![CDATA[Envelhecer é acumular frustrações Eu&#8230; meia garrafa de vodka depois *** Needled by Threads Python, FastCGI, WSGI, and lighttpd Propellerheads &#8211; Crash]]></description>
			<content:encoded><![CDATA[<blockquote><p>Envelhecer é acumular frustrações</p></blockquote>
<p><cite class="citesrc">Eu&#8230; meia garrafa de vodka depois</cite></p>
<div style="text-align:center;">***</div>
<ul>
<li><a href="http://cleverdevil.org/computing/30/"> Needled by Threads</a></li>
<li><a href="http://cleverdevil.org/computing/24/"> Python, FastCGI, WSGI, and lighttpd</a></li>
</ul>
<div class="listening">Propellerheads &#8211; Crash</div>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2005/09/21/234/filosofia-de-bar/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Ajax, prototype.js, MochiKit</title>
		<link>http://www.burocrata.org/blog/archives/2005/09/08/231/ajax-prototypejs-mochikit/</link>
		<comments>http://www.burocrata.org/blog/archives/2005/09/08/231/ajax-prototypejs-mochikit/#comments</comments>
		<pubDate>Thu, 08 Sep 2005 16:18:29 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/archives/2005/09/08/231/ajax-prototypejs-mochikit/</guid>
		<description><![CDATA[Acho que estou ficando velho e avesso a ficar aprendendo linguagens novas apenas pela mastrubação mental. JavaScript então consegue ir além da simples preguiça &#8212; a linguagem é horrivel de ler, estranha demais! Parece que existem agora algumas ferramentas que melhoram sensivelmente esse problema, fazendo programação AJAX ficar trivialmente fácil.]]></description>
			<content:encoded><![CDATA[<p>Acho que estou ficando velho e avesso a ficar aprendendo linguagens novas apenas pela mastrubação mental. JavaScript então consegue ir além da simples preguiça &#8212; a linguagem é horrivel de ler, estranha demais! Parece que existem agora <a href="http://griddlenoise.blogspot.com/2005/09/prototypejs-and-mochikit.html">algumas ferramentas que melhoram sensivelmente esse problema</a>, fazendo programação AJAX ficar trivialmente fácil.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2005/09/08/231/ajax-prototypejs-mochikit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Doublecast</title>
		<link>http://www.burocrata.org/blog/archives/2005/05/23/210/doublecast/</link>
		<comments>http://www.burocrata.org/blog/archives/2005/05/23/210/doublecast/#comments</comments>
		<pubDate>Mon, 23 May 2005 21:23:15 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Mestrado]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/archives/2005/05/22/210/the-python-challenge/</guid>
		<description><![CDATA[Fazia um bom tempo que eu não aparecia por aqui. Resolvi vir e fazer um post mais para fins de bookmarking do que para qualquer outra coisa. É, outras coisas têm ocupado a minha mente e me envolvido numa áurea de culpa da qual está cada vez mais complicado me despir. De qualquer forma, eu [...]]]></description>
			<content:encoded><![CDATA[<p>Fazia um bom tempo que eu não aparecia por aqui. Resolvi vir e fazer um <span lang="en">post</span> mais para fins de <span lang="en">bookmarking</span> do que para qualquer outra coisa. É, outras coisas têm ocupado a minha mente e me envolvido numa áurea de culpa da qual está cada vez mais complicado me despir.</p>
<p>De qualquer forma, eu ainda não esqueci esse blog. Acreditem. <a href="http://fernando.dubtribe.com/archives/2005/05/14/rss-style-for-your-wp-feed/">CSS Style for you WordPress RSS Feed</a>.</p>
<div style="text-align:center;">***</div>
<p>Toda vez que eu volto de Fortaleza uma gripe se prende às minhas pernas e eu tenho que carregá-la por pelo menos uma semana a tira-colo para poder livrar-me dela.</p>
<p>Dessa vez peguei uma amidalite, com direito a antibiótico e tudo mais. Pelo visto a amidalite já deu uma trégua, mas deixou uma saudosa (?!) gripe no lugar. Realmente, foi uma ótima semana em Fortaleza.</p>
<div style="text-align:center;">***</div>
<p>Eu deveria ter me afastado deles por mais tempo, mas uma tarde de domingo morosa sempre é uma boa desculpa para retomar a antigos vícios.</p>
<p>O chato é que parece que, logo agora que eu finalmente consegui fazer o Titus e a Yuna se agarrarem, terei que me afastar deles mais uma vez. Por mais uma semana, quem sabe? Quem sabe eu consigo pegar o <em>doublecast</em> da próxima vez?!</p>
<div style="text-align:center;">***</div>
<p>Sim, falando em vícios, o python-link do dia é esse: <a href="http://www.pythonchallenge.com/"> The Python Chalange</a>. Descubra o quando você realmente sabe usar a sua linguagem preferida. Mas não vale <a title="Python Challenge Solutions - Part 2" href="http://gumuz.looze.net/wordpress/index.php/archives/2005/05/20/python-challenge-solutions-part-2/">&#8220;trapacear&#8221;</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2005/05/23/210/doublecast/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Escandalos nas comunidades On-lines</title>
		<link>http://www.burocrata.org/blog/archives/2005/04/01/199/escandalos-nas-comunidades-on-lines/</link>
		<comments>http://www.burocrata.org/blog/archives/2005/04/01/199/escandalos-nas-comunidades-on-lines/#comments</comments>
		<pubDate>Fri, 01 Apr 2005 16:48:38 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[T.C.P.C.E.P.]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/archives/2005/04/01/199/escandalos-nas-comunidades-on-lines/</guid>
		<description><![CDATA[Ontem a notícia da hora era que Matt Mullenweg, o homem atrás do WordPress, o sistema de blogging usado por todo mundo da C9 e bastante popular mundo afora, estaria participando de um esquema link-spam. Não vou entrar no mérito de julgar o que ele fez. Já existem opiniões demais sobre isso na Web, para [...]]]></description>
			<content:encoded><![CDATA[<p>Ontem a <a href="http://slashdot.org/article.pl?sid=05/03/31/196220&#038;tid=217" title="Wordpress Banned by Google for Spamming">notícia da hora</a> era que Matt Mullenweg, o homem atrás do <a href="http://wordpress.org">WordPress</a>, o sistema de blogging usado por <a href="http://www.zite.org">todo</a> <a href="http://ventonegro.org">mundo</a> 	<a href="http://sellaro.eti.br/">da</a><br />
 C9 e bastante popular mundo afora, estaria participando de um esquema link-spam. Não vou entrar no mérito de julgar o que ele fez. Já existem opiniões demais sobre isso na Web, para que mais uma?</p>
<p>O único ponto que eu gostaria de fazer é sobre como, de repente, as pessoas podem criar grande comunidades na internet e como isso traz, mesmo que a contra gosto, responsabilidade. Como bem poderia dizer meu amigo Rommel, &#8220;onde tem o humano, existe o politico&#8221;.</p>
<p>Hoje, pelo menos para mim, a bomba do dia é que o sítio dos 	<a href="http://www.little-gamers.com">Little-Gamers</a> foi fechado pela <a href="http://www.mpaa.org/home.htm" title="Devil's Live Here">MPAA</a>. Sinceramente não sei o que pensar&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2005/04/01/199/escandalos-nas-comunidades-on-lines/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>É pop e é ruim</title>
		<link>http://www.burocrata.org/blog/archives/2005/03/23/195/e-pop-e-e-ruim/</link>
		<comments>http://www.burocrata.org/blog/archives/2005/03/23/195/e-pop-e-e-ruim/#comments</comments>
		<pubDate>Wed, 23 Mar 2005 18:38:22 +0000</pubDate>
		<dc:creator>MaCa</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.burocrata.org/blog/archives/2005/03/23/195/e-pop-e-e-ruim/</guid>
		<description><![CDATA[Acordei com vontade de mandar alguém ir tomar onde o sol não brilha. Abro meus e-mails e vejo alguém dizendo mais uma pérola do gênero &#8220;Ah, Dj Fulano é muito pop&#8230; e é ruim.&#8221; Para que tanta hipocrisia! Larga de frescura e diga logo que você detesta-o apenas porque ele é pop, seu pescoçudo idiota! [...]]]></description>
			<content:encoded><![CDATA[<p>Acordei com vontade de mandar alguém ir tomar onde o sol não brilha. Abro meus e-mails e vejo alguém dizendo mais uma pérola do gênero <cite>&#8220;Ah, Dj Fulano é muito pop&#8230; <strong>e</strong> é ruim.&#8221;</cite></p>
<p>Para que tanta hipocrisia! Larga de frescura e  diga logo que você detesta-o apenas <strong>porque</strong> ele é pop, seu <a href="http://www.devir.com.br/hqs/caco.php">pescoçudo</a> idiota!</p>
<div style="text-align:center;">***</div>
<p>Nerds: <a href="http://www.zite.org">por</a> <a href="http://sellaro.eti.br">quê</a> <a href="http://www.marmota.org/" title="Marmota.org - Mais do mesmo">eles</a> <a href="http://ventonegro.org" title="Vento Negro . ORG">gostam</a> do .org?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.burocrata.org/blog/archives/2005/03/23/195/e-pop-e-e-ruim/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

