My little blog can’t be this cute!

My git server setup.xhtml (1789B)

  1. <article xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" class="h-entry">
  2. <h1 class="p-name"><a class="u-url" href="/articles/My%20git%20server%20setup">My git server setup</a></h1>
  3. <p>So after having problems with gitlab.com (not being able to push to your own repository for example). I decided to have a very simple git setup, inspired by git.linkmauve.fr. I putted all my git repos into <code>/git</code>.</p>
  4. <h2>started with just nginx and ssh</h2>
  5. <p>This one is dead-simple when you know the trick, simply put <code>git update-server-info</code> into <code>hooks/post-update</code> or <code>hooks/post-receive</code> of your git repo (they have to be bare repo, that’s done with --bare)</p>
  6. <h2>Added git-daemon</h2>
  7. <p>That one was even more simple, just had to point to where the git repositories are stored</p>
  8. <h2>Wanted a better interface</h2>
  9. <p>While searching for alternatives to GNU I saw <a href="http://git.2f30.org/stagit/">stagit</a>, a static git generator (I don’t like CGI, specially when it could have access to my git repos), to use it I added theses lines to the post-update-hook</p>
  10. <pre><code>repo=$(pwd)
  11. cd "$(pwd | sed s/.git$//)" &amp;&amp; stagit -c "$repo.cache" "$repo"
  12. cd /git &amp;&amp; stagit-index *.git &gt; /git/index.html</code></pre>
  13. <h2>Garbage Collector</h2>
  14. <p>It’s not like my repos were getting big, git is supposed to do that itself but it seems like it doesn’t, so I’m doing <code>git gc</code> each time, which isn’t very optimised.</p>
  15. <h2>Final Hook code (deploy, stagit, …)</h2>
  16. <p>This can be seen in my <a href="/git/utils">/git/utils</a> repo, in the <code>git-hooks</code> folder.</p>
  17. <p>Also the blog is a symlink to <code>/git/blog.work</code> which are the raw files done by that hook.</p>
  18. </article>