<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tommi&#039;s stuff &#187; Open Source</title>
	<atom:link href="http://tommi.org/category/opensource/feed/" rel="self" type="application/rss+xml" />
	<link>http://tommi.org</link>
	<description></description>
	<lastBuildDate>Wed, 11 Jan 2012 17:25:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Git through apache, anonymous pull but authenticated push</title>
		<link>http://tommi.org/2012/01/git-through-apache-anonymous-pull-but-authenticated-push/</link>
		<comments>http://tommi.org/2012/01/git-through-apache-anonymous-pull-but-authenticated-push/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 17:20:53 +0000</pubDate>
		<dc:creator>tommi</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[auth]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[pull]]></category>
		<category><![CDATA[push]]></category>

		<guid isPermaLink="false">http://tommi.org/?p=33</guid>
		<description><![CDATA[I have been having this annoying issue where I needed to open ssh up to the internet in order to allow authenticated push with a centralized git server. After hours and hours of trying to master anonymous pull and authenticated &#8230; <a href="http://tommi.org/2012/01/git-through-apache-anonymous-pull-but-authenticated-push/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been having this annoying issue where I needed to open ssh up to the internet in order to allow authenticated push with a centralized git server. After hours and hours of trying to master <strong>anonymous pull</strong> and <strong>authenticated push</strong> over http I finally made it, here goes:</p>
<h3>Set the project root, where your git repositories are and you want to export everything:</h3>
<pre>SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL</pre>
<h3>Next we have to map the git http backend to a URL</h3>
<pre># Enable git-http-backend
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/</pre>
<h3>Get mod_rewrite to set a environment variable on push</h3>
<pre># Enable mod_rewrite
RewriteEngine On

# Detect git push
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR,NC]
RewriteCond %{REQUEST_URI} ^/git/.*/git-receive-pack$ [NC]
RewriteRule .* - [E=AUTHREQUIRED:yes]</pre>
<h3>Demand auth on /git when pushing through Location</h3>
<pre>&lt;Location /git&gt;
        # If any deny clause matches, if authrequired is set
        Order Allow,Deny
        Deny from env=AUTHREQUIRED
        Allow from all
        # Satisfy either Allow/Deny or Require valid-user
        Satisfy Any
        # Auth info
        AuthType Basic
        AuthName "Git Access"
        # Password file created with htpasswd
        AuthUserFile /etc/httpd/conf.d/passwd
        Require valid-user
&lt;/Location&gt;</pre>
<h3>Happy git push&#8217;ing!</h3>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Ftommi.org%2F2012%2F01%2Fgit-through-apache-anonymous-pull-but-authenticated-push%2F&amp;title=Git%20through%20apache%2C%20anonymous%20pull%20but%20authenticated%20push" id="wpa2a_2"><img src="http://tommi.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://tommi.org/2012/01/git-through-apache-anonymous-pull-but-authenticated-push/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

