waffel’s Weblog

September 1, 2009

git over https failed to push some refs

Filed under: git — Thomas Wabner @ 5:38 pm
Tags: , , ,

I have tried to use our main git repository over https but I had gotten error messages like

PUT 54510da55977f5c1e47e5356b996762f4544b90d failed, aborting (22/403)
MKCOL 3b04e830cf4e221491e38443beac0f2f4a2e61c1 failed, aborting (22/403)
PUT 96496dc5f4115e3b9a90757410158f2ba7d12c80 failed, aborting (22/403)
MKCOL af7988694ce7cc8fbfd6b40deffe78d7231cffc8 failed, aborting (22/403)
Updating remote server info
error: failed to push some refs to 'https://myserver.de/myproject.git'

It was hard to discover whats going wrong here. I have set the GIT_CURL_VERBOSE=1 flag to see if there was an communication problem with my server. The communication itself was ok … but the server returns always a 403 (permission denied).

Next I had a look into my apache logs and I had seen follow error messages:

Permission denied: Unable to create a collection.

This looks like a file permission problem. I have setup a new group for my git repository and give apache the rights for read and write. But the problems still occured.

The solution was to set the correct Limit directive in the configuration for my git repository:

Alias /git /usr/var/git
<directory "/usr/var/git">
  DAV filesystem
  Options +Indexes

  AuthType Basic
  AuthName "git repositories"
  AuthUserFile /etc/apache/git.users.auth

    Require valid-user

After a apache reload the push and pull commands working nice.

Bloggen auf WordPress.com.