Page MenuHomePhabricator

Git http operations fail with username in url
OpenPublic

Asked by Grimeh on Apr 12 2016, 9:09 PM.

Details

So for example, cloning a git repo hosted on Diffusion with the URL like so:
http://<username>@<our-company-url>/diffusion/<repo>.git/
It doesn't prompt for password and fails with 403 (I assume because no password was given). However, if the username is omitted from the URL, it prompts for both username and password as normal.

I've noticed this happening for a while but it's never been a blocker. However now that I'm setting up automated builds for my company I need to find out the root cause of this, since the system (Teamcity and Phabricator plugin) formats URLs like that. Not sure if this is a Phabricator or a Git problem, but seeing as I can't replicate this with Github I thought I'd post here first.

Is this a known issue with Diffusion, or is it perhaps a misconfiguration on my part?

Edit: Ran a clone with GIT_CURL_VERBOSE and GIT_TRACE on:

brandon@akcserver:~$ GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone http://brandon@10.21.7.10/diffusion/23/tct.git/
14:34:11.644314 git.c:351               trace: built-in: git 'clone' 'http://brandon@10.21.7.10/diffusion/23/tct.git/'
Cloning into 'tct'...
14:34:12.712086 run-command.c:336       trace: run_command: 'git-remote-http' 'origin' 'http://brandon@10.21.7.10/diffusion/23/tct.git/'
* Couldn't find host 10.21.7.10 in the .netrc file; using defaults
* Hostname was NOT found in DNS cache
*   Trying 10.21.7.10...
* Connected to 10.21.7.10 (10.21.7.10) port 80 (#0)
> GET /diffusion/23/tct.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/2.8.1
Host: 10.21.7.10
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-CA, en;q=0.9, *;q=0.8
Pragma: no-cache

* HTTP 1.0, assume close after body
< HTTP/1.0 401 You must log in to access repositories.
< Date: Tue, 12 Apr 2016 21:34:12 GMT
< Server: Apache/2.4.10 (Debian)
< WWW-Authenticate: Basic realm="Phabricator Repositories"
< Content-Length: 43
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
* Closing connection 0
* Issue another request to this URL: 'http://brandon@10.21.7.10/diffusion/23/tct.git/info/refs?service=git-upload-pack'
* Couldn't find host 10.21.7.10 in the .netrc file; using defaults
* NTLM-proxy picked AND auth done set, clear picked!
* Hostname was found in DNS cache
*   Trying 10.21.7.10...
* Connected to 10.21.7.10 (10.21.7.10) port 80 (#1)
* Server auth using Basic with user 'brandon'
> GET /diffusion/23/tct.git/info/refs?service=git-upload-pack HTTP/1.0
Authorization: Basic YnJhbmRvbjo=
User-Agent: git/2.8.1
Host: 10.21.7.10
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-CA, en;q=0.9, *;q=0.8
Pragma: no-cache

* HTTP 1.0, assume close after body
< HTTP/1.0 403 Invalid credentials.
< Date: Tue, 12 Apr 2016 21:34:13 GMT
< Server: Apache/2.4.10 (Debian)
< Content-Length: 24
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
* Closing connection 1
fatal: unable to access 'http://brandon@10.21.7.10/diffusion/23/tct.git/': The requested URL returned error: 403

Answers

Mnkras
Updated 2,929 Days Ago

Can you try:
http://brandon:<password here>@10.21.7.10/diffusion/23/tct.git/

New Answer