I originally asked this over at Q361 but I'm fairly sure it's a bug at this point so I'm filing it here.
Description
So for example, cloning a git repo hosted on Diffusion with the URL like so:
http://<username>@<our-phabricator-installation-ip>/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, or is it perhaps a misconfiguration on my part?
Trace
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
Configuration
We have an internal server running Debian 8 with Apache for our webserver. Everything's been updated through aptitude on a regular basis (at least once a month). Updated Phabricator (including libphutil and arcanist) on Monday.
I manually built and installed the latest version of Git (2.8.1) seeing as the latest available via Debian stable is significantly older. No noticeable difference.
Reproducing
- Create a new Git repository (or use an existing one I guess) on your Phabricator installation
- Make sure your local Git installation isn't configured to use any credential helpers
- Try to clone it with username in URL (eg. http://<username>@<your-phabricator-installation>/diffusion/<your-repo-name-or-number>.git/)
- Clone should fail without prompting for password
- Try without the username (eg. http://<your-phabricator-installation>/diffusion/<your-repo-name-or-number>.git/)
- Git should prompt for username and password
- Clone should succeed, assuming the username and password is correct and you have access to the repository in question
Even if it is a misconfiguration on my part, I'd love if someone could confirm that.