Installing GIT from Virtualmin is easy. You just need to go to Edit Server->Enabled features->Allow Git Repositories
Create a repo by going to Services->Git repositories:
Then go to Edit Users->select a user->Other user permissions and grant them access to your new repo:
You are now ready to add your local code to the new repo:
cd ~/firmware git --bare init echo hello > hello.txt git add hello.txt git commit -m 'initial checkin' git push upload master
If only things were that simple! The push command results in error:
git push origin master error: Cannot access URL http://***.com/git/firmware.git/, return code 22 fatal: git-http-push failed
The access logs shows some authorisation problems:
[11/Dec/2014:18:49:53 +0000] "PROPFIND /git/firmware.git/ HTTP/1.1" 401 401 "-" "git/1.9.3 (Apple Git-50)"
I found several interesting articles on this topic. Below are a few:
Some of them were blaming the default VirtualMin’s GIT module (ver. 1.9.3 when writing this article), that doesn’t use smart http mode. Instead it relies on DAV for pushing commits to the server. So I tried configuring the smart git module, but to no avail.
Looking over the server’s access log I saw a few doubled requests coming from the GIT client. Usually one was authenticated (was using a username) while the other not. Some suggested this was a bug in the local GIT client, so I had it updated from 1.9.3 to latest 2.0.1, using symbolic links on MacOS to override the system’s default git. This didn’t help either.
I blamed DAV and spent endless hours trying to change its configuration. Nothing.
Finally using curl (http://maymay.net/blog/2008/08/08/how-to-use-http-basic-authentication-with-git/) and the server’s access log, I managed to see a few interesting things:
– my GIT connection attempts always went to the default virtual host (out of several on my server). My git repo was NOT on the default virtual host.
– I was getting lots of http 400 error codes
Apparently, my git client traffic was being partially blocked by Incapsula, that I was using to secure my website traffic. So getting around Incapsula solved part of the problems. Next I created a repo on my default virtual host: with Incapsula out of the way, it worked perfectly!