git push 上的 MKCOL 405 和 LOCK 500(错误:无法锁定现有信息/参考)

git push 上的 MKCOL 405 和 LOCK 500(错误:无法锁定现有信息/参考)

我在使用 apache 设置 Git 服务器时遇到了一些麻烦。

这是我的 gitrepo.conf:

DavLockDB "opt/local/apache2/var/DavLock"

<Directory /opt/local/apache2/htdocs/repo>
  DAV On
  Deny from all
  AuthType Basic
  AuthName "Git repositories"
  AuthUserFile /etc/apache2/other/htpasswd
  AuthGroupFile /etc/apache2/other/htgroup-git
</Directory>

<Directory /opt/local/apache2/htdocs/repo/myproject.git>
  Allow from all
  Order allow,deny
  <Limit GET>
    Require group myproject-reader
  </Limit>
  <Limit GET PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
    Require group myproject-writer
  </Limit>
</Directory>

当我git push去时http://admin@localhost/repo/myproject.git,我得到了这个:

error: cannot lock existing info/refs
fatal: git-http-push failed

以下是我的 access_log 的片段:

::1 - - [28/Jul/2012:19:05:52 +0100] "GET /repo/myproject.git/info/refs?service=git-receive-pack HTTP/1.1" 401 401
::1 - admin [28/Jul/2012:19:05:52 +0100] "GET /repo/myproject.git/info/refs?service=git-receive-pack HTTP/1.1" 401 401
::1 - admin [28/Jul/2012:19:05:55 +0100] "GET /repo/myproject.git/info/refs?service=git-receive-pack HTTP/1.1" 200 -
::1 - admin [28/Jul/2012:19:05:55 +0100] "GET /repo/myproject.git/HEAD HTTP/1.1" 200 23
::1 - - [28/Jul/2012:19:05:57 +0100] "PROPFIND /repo/myproject.git/ HTTP/1.1" 401 401
::1 - admin [28/Jul/2012:19:05:57 +0100] "PROPFIND /repo/myproject.git/ HTTP/1.1" 207 558
::1 - admin [28/Jul/2012:19:05:57 +0100] "HEAD /repo/myproject.git/info/refs HTTP/1.1" 200 -
::1 - admin [28/Jul/2012:19:05:57 +0100] "HEAD /repo/myproject.git/objects/info/packs HTTP/1.1" 200 -
::1 - admin [28/Jul/2012:19:05:57 +0100] "MKCOL /repo/myproject.git/info/ HTTP/1.1" 405 249
::1 - admin [28/Jul/2012:19:05:57 +0100] "LOCK /repo/myproject.git/info/refs HTTP/1.1" 500 535

我似乎遇到了 MKCOL 错误 405 和 LOCK 错误 500。

这是我的错误日志:

[Sat Jul 28 19:05:52 2012] [error] [client ::1] user admin: authentication failure for "/repo/myproject.git/info/refs": Password Mismatch
[Sat Jul 28 19:05:57 2012] [error] [client ::1] Could not LOCK /repo/myproject.git/info/refs due to a failed precondition (e.g. other locks).  [500, #0]
[Sat Jul 28 19:05:57 2012] [error] [client ::1] The locks could not be queried for verification against a possible "If:" header.  [500, #0]
[Sat Jul 28 19:05:57 2012] [error] [client ::1] Could not open the lock database.  [500, #400]
[Sat Jul 28 19:05:57 2012] [error] [client ::1] (2)No such file or directory: Could not open property database.  [500, #1]

和我输入正确的密码,就像git remote show origin要求输入密码的命令一样,密码会被正常接受。

有任何想法吗?

答案1

我终于找到了解决办法,而且它也非常简单。

这:

DavLockDB "opt/local/apache2/var/DavLock"

应该是这样的:

DavLockDB "/opt/local/apache2/var/DavLock"

注意/文件名开头的。

相关内容