git/list[1] front-page[2] threads[3] people[4] search[5] about
 

HTTP push not respecting .netrc

From
DBDavid Borowitz <dave@bwitz.com>
Date
Dec 30, 2010, 06:56 UTC
Message-ID
<AANLkTik84-zRwi+0dGGFoTUrj6Zr3bxO=fE9P_3MuZdZ@mail.gmail.com>
Hi all,

I'm trying to push to a smart HTTP remote using the following command line: http_proxy=localhost:4242 git push -v http://xxxxx:25989/git/foo +refs/heads/*:refs/heads/* (The weird proxy and port are not under my control.)

The webserver should return 401 for unauthorized access, and indeed it does: error: RPC failed; result=65, HTTP code = 401 (The rest of the error text from git push is not particularly useful, but I'm not worried about that at the moment.)

Making a request manually with curl --netrc shows that the auth header is being sent[1]. But sniffing the HTTP traffic from git shows that the auth header is not sent[2].

I also tried various other things like aliasing xxxxx to 127.0.0.1 and removing the proxy and port number, and specifying user@xxxxx in the URL, and nothing I've done makes git send the necessary auth header. (In the last case it does prompt for a password.)

Anyone have any other ideas? I could swear this was working a few weeks ago, so I must be missing something simple.

[1]
$ http_proxy=localhost:4242 curl -vvn
http://xxxxx:25989/git/foo/info/refs?service=git-receive-pack
* About to connect() to proxy localhost port 4242 (#0)
*   Trying ::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 4242 (#0)
* Server auth using Basic with user 'yyyyy'         <----
Show 7 quoted lines
> GET http://xxxxx:25989/git/foo/info/refs?service=git-receive-pack HTTP/1.1
> Authorization: Basic zzzzzzzz          <----
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: xxxxx:25989
> Accept: */*
> Proxy-Connection: Keep-Alive
>

< HTTP/1.1 200 OK ...

[2]
GET http://xxxxx:25989/git/foo/info/refs?service=git-receive-pack HTTP/1.1
User-Agent: git/1.7.4.rc0
Host: xxxxx:25989
Accept: */*
Proxy-Connection: Keep-Alive
Pragma: no-cache
Next: Tay Ray Chuan
Message 1 of 5 in “HTTP push not respecting .netrc”
  1. David BorowitzDec 30, 2010
  2. Tay Ray ChuanDec 31, 2010
  3. Junio C HamanoJan 13, 2011
  4. David BorowitzJan 13, 2011
  5. David BorowitzJan 27, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.