Setting up Git on AWS was easy. It was a lot harder to get HTTP pull and push access. WebDAV worked for pull, but pushing kept giving return code 22.
Turned out that the article for that was outdated and the new method involves git-http-backend.
http://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html
Instructions there are meant for general use. Some things need to be changed for Ubuntu 12.04.
sudo a2enmod cgi
sudo a2enmod alias
sudo a2enmod env
but those should already be enabled.
Put server config lines in httpd.conf, which is empty on AWS as the main apache config file is apache2.conf
Set GIT_PROJECT_ROOT to parent directory of all the .git folders
ScriptAlias is /usr/lib/git-core/git-http-backend/ instead of the libexec folder shown in the instructions. The final slash is important!! Found this out by checking the error log.
Added to /etc/apache2/sites-enabled/000-default file
In conf.d folder, added git.conf file.
<Location /git/repo.git>
AuthType Basic
AuthName "Private Git Access"
AuthUserFile /etc/apache2/passwd.git
Require valid-user
</Location>
This ensures authentication is needed. Create the password file with htpasswd
chown and chmod all the files and folders in the repository to give www-data read/write access.
