Git fails to push to secured webdav

793 views
Skip to first unread message

RandomInsano

unread,
Mar 31, 2011, 5:06:12 AM3/31/11
to msysGit
Aloha!

I built a simple WebDAV share on my server. WebDAV is working
marvelously! Git isn't :(

Basically, when I auth with the server, git doesn't use those
credentials when it does a WebDAV PROPFIND command, so it recieves a
401 not authorized response.

This is the back and forth between git and my webserver:

[Initial push, failing due to security settings[
10.0.0.100 - - [31/Mar/2011:03:48:27 -0500] "GET /dav/git/coral.git/
info/refs?service=git-receive-pack HTTP/1.1" 401 409
10.0.0.100 - - [31/Mar/2011:03:48:31 -0500] "GET /dav/git/coral.git/
info/refs?service=git-receive-pack HTTP/1.1" 401 409
[Git has now asked for my password]
10.0.0.100 - edwin [31/Mar/2011:03:48:31 -0500] "GET /dav/git/
coral.git/info/refs?service=git-receive-pack HTTP/1.1" 200 0
10.0.0.100 - edwin [31/Mar/2011:03:48:31 -0500] "GET /dav/git/
coral.git/HEAD HTTP/1.1" 200 23
[Woo! Auth'd!]
10.0.0.100 - - [31/Mar/2011:03:48:32 -0500] "PROPFIND /dav/git/
coral.git/ HTTP/1.1" 401 397
[WTF?! FAIL!]

Any ideas what's causing this? Which libraries are to blame, etc?

Pat Thoyts

unread,
Mar 31, 2011, 5:15:10 AM3/31/11
to RandomInsano, msysGit
You don't give enough information about this. How is the webdav setup
- apache? What remote url did you use with git - show the command line
you used that failed.
Try enabling tracing by setting GIT_TRACE=1 and re-running the command
and see if anything useful gets emitted.

Erik Faye-Lund

unread,
Mar 31, 2011, 5:19:33 AM3/31/11
to RandomInsano, msysGit

Didn't you already report this to the main Git list yetsterday?

http://article.gmane.org/gmane.comp.version-control.git/170280

Besides, it seems to me that this question has been asked and answered before:

http://article.gmane.org/gmane.comp.version-control.git/105397

Erik Faye-Lund

unread,
Mar 31, 2011, 5:57:58 AM3/31/11
to Edwin Amsler, Git Mailing List, msysGit
Please don't cull the CC-list (hit "reply all" in your mailing list).
I'm not personally interested in the subject, so I'm not a likely
person to get help from.

On Thu, Mar 31, 2011 at 11:52 AM, Edwin Amsler <edwi...@gmail.com> wrote:

> Indeed I did report to the main list! Sometimes it's best to ask at multiple
> sources, despite the annoyance for those who are members of both groups.
> Sorry for the double post for you.
>
> The problem you referenced (git/webdav is refusing to authenticate properly)
> has the issue that git never tried to authenticate. Mine did. Then just
> forgot to use the authentication.
>

Did you setup your .netrc file like
Documentation/howto/setup-git-server-over-http.txt tells you to?

http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/howto/setup-git-server-over-http.txt;h=622ee5c8dd7c384794a21baa6093d85a47f89a54;hb=HEAD

Pat Thoyts

unread,
Apr 1, 2011, 6:33:42 AM4/1/11
to Edwin, msysGit
On 1 April 2011 03:36, Edwin <edwi...@gmail.com> wrote:
> There might be something more sinister here... I've been doing some testing,
> and no matter what I do (I've disabled auth completely and locked apache to
> my local network), git will not clone my proper repository. The clone ends
> in an empty repository, even though I've added a large number of files
> through "git clone ssh://myserver/my/path/coral.git"
>
> I noticed that the main git repository's url:
> http://git.kernel.org/pub/scm/git/git.git/info/refs
> refs is in fact a file.
>
> On my server,
> http://<server>/dav/git/coral.git/info/refs
> refs is a folder with the following structure:
> ./refs
> ./refs/heads
> ./refs/heads/master
> ./refs/tags
>
> Could this be the root of the problem?
>
> Also, the contents of HEAD are:
> ref: refs/heads/master
>
> I've followed> somewhat closely, but it doesn't mention the update-server-info command at
> all :S
>
> Here is the exact exchange I've done for creating a repository:
>
> Server:
> $ mkdir test.git
> $ cd test.git/
> $ git --bare init
> Initialized empty Git repository in /var/www/htdocs/dav/git/test.git/
> $ sudo chown -R edwin:www test.git/
> Password:
> $
>
> Client:
> Edwin@EDWIN_COMP_WIN ~
> $ git clone http://coalfurnace.dyndns.org/dav/git/test.git
> Cloning into test...
> fatal: http://coalfurnace.dyndns.org/dav/git/test.git/info/refs not found:
> did you run git update-server-info on the server?
> $
>
> Server:
> $ git update-server-info
>
> Client:
> Edwin@EDWIN_COMP_WIN ~
> $ git clone http://coalfurnace.dyndns.org/dav/git/test.git
> Cloning into test...
> warning: You appear to have cloned an empty repository.
> $
>
> And here I am with a repo which doesn't clone properly over HTTP, but works
> perfectly fine via SSH or local cloning.
>

After you initialize the bare repository on your server there are two
additional tasks commonly recommended. 'touch git-daemon-export-ok' if
you want to be able to expose the repository using git-web and/or the
git:// protocol server. Secondly, rename the hooks/post-update.sample
to post-update and ensure it is executable. That hook runs after new
changesets are pushed in and the default version just calls
update-server-info for you.

Edwin

unread,
Mar 31, 2011, 10:36:39 PM3/31/11
to Pat Thoyts, msysGit
On 2011-03-31 4:15 AM, Pat Thoyts wrote:
Reply all
Reply to author
Forward
0 new messages