Page MenuHomePhabricator

error: The requested URL returned error: 403 while accessing repository
Closed, DuplicatePublic

Description

I get a 403 error when trying to clone repositories.
The repository is hosted on Phabricator

policy.allow-public set to true
Web Service works fine.

Below the full output from the console:

root@server:~# GIT_CURL_VERBOSE=1 git clone http://code.example.com/diffusion/TEST/test.git
Cloning into 'test'...
* Couldn't find host code.example.com in the .netrc file; using defaults
* About to connect() to code.example.com port 80 (#0)
*   Trying 192.168.168.111... * connected
> GET /diffusion/TEST/test.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.9.5
Host: code.example.com
Accept: */*
Pragma: no-cache

* The requested URL returned error: 401
* Closing connection #0
Username for 'http://code.example.com': admin
Password for 'http://admin@code.example.com':
* Couldn't find host code.example.com in the .netrc file; using defaults
* About to connect() to code.example.com port 80 (#0)
*   Trying 192.168.168.111... * connected
> GET /diffusion/TEST/test.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.9.5
Host: code.example.com
Accept: */*
Pragma: no-cache

* HTTP 1.0, assume close after body
< HTTP/1.0 401 You must log in to access this repository.
< Date: Tue, 22 Apr 2014 07:34:32 GMT
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.3.10-1ubuntu3.11
< WWW-Authenticate: Basic realm="Phabricator Repositories"
< Content-Length: 46
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
* Closing connection #0
* Issue another request to this URL: 'http://code.example.com/diffusion/TEST/test.git/info/refs?service=git-upload-pack'
* Couldn't find host code.example.com in the .netrc file; using defaults
* About to connect() to code.example.com port 80 (#0)
*   Trying 192.168.168.111... * connected
* Server auth using Basic with user 'admin'
> GET /diffusion/TEST/test.git/info/refs?service=git-upload-pack HTTP/1.0
Authorization: Basic YWRtaW46S2FtZW5pcHphMDA3
User-Agent: git/1.7.9.5
Host: code.example.com
Accept: */*
Pragma: no-cache

* The requested URL returned error: 403
* Closing connection #0
* Couldn't find host code.example.com in the .netrc file; using defaults
* About to connect() to code.example.com port 80 (#0)
*   Trying 192.168.168.111... * connected
* Server auth using Basic with user 'admin'
> GET /diffusion/TEST/test.git/info/refs HTTP/1.1
Authorization: Basic YWRtaW46S2FtdW5pdHphMDA3
User-Agent: git/1.7.9.5
Host: code.example.com
Accept: */*
Pragma: no-cache

* The requested URL returned error: 403
* Closing connection #0
error: The requested URL returned error: 403 while accessing http://code.example.com/diffusion/TEST/test.git/info/refs
fatal: HTTP request failed

VirtualHost Configuration:

<VirtualHost *:80>
  # Change this to the domain which points to your host.
  ServerName code.example.com
  ServerAdmin  webmaster@example.com
  ServerAlias  code.example.com

  # Change this to the path where you put 'phabricator' when you checked it
  # out from GitHub when following the Installation Guide.
  #
  # Make sure you include "/webroot" at the end!
  DocumentRoot /opt/phabricator/webroot/

  RewriteEngine On
  RewriteRule ^/rsrc/(.*)     -                       [L,QSA]
  RewriteRule ^/favicon.ico   -                       [L,QSA]
  RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]

  <Directory /opt/phabricator/webroot>
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error-git.log
  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel debug
  CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

error.log

192.168.168.111 - - [22/Apr/2014:11:34:51 +0200] "GET /diffusion/TEST/test.git/info/refs?service=git-upload-pack HTTP/1.1" 401 349 "-" "git/1.7.9.5"
192.168.168.111 - - [22/Apr/2014:11:35:01 +0200] "GET /diffusion/TEST/test.git/info/refs?service=git-upload-pack HTTP/1.1" 401 349 "-" "git/1.7.9.5"
192.168.168.111 - admin [22/Apr/2014:11:35:01 +0200] "GET /diffusion/TEST/test.git/info/refs?service=git-upload-pack HTTP/1.0" 403 247 "-" "git/1.7.9.5"
192.168.168.111 - admin [22/Apr/2014:11:35:01 +0200] "GET /diffusion/TEST/test.git/info/refs HTTP/1.1" 403 247 "-" "git/1.7.9.5"

When using:
http://code.exemple.com/diffusion/TEST/info/refs?service=git-receive-pack
in web browser, I get:

403 Invalid credentials.

Event Timeline

sicnervo assigned this task to epriestley.
sicnervo raised the priority of this task from to Needs Triage.
sicnervo updated the task description. (Show Details)
sicnervo added a subscriber: sicnervo.

YOU NEED TO CHANGE YOUR PASSWORD

It got included in the log output you posted.

Thanks for the tip.
And when it comes to my problem, do you have any advice?

  • If you want to use the repository without authenticating (you mention policy.allow-public is set to true) you need to set the read access to the repository in Diffusion -> (The Repository) -> Edit Repository -> Edit Policies and set "Visible To" to "Public (No Login Required)".
  • If you do want to authenticate, have you configured a VCS password, under Settings -> VCS Password? This is a different password from any primary password attached to your account, and you might be trying to log in without setting a VCS password first.

Here are my settings:

Case 1

  • diffusion.allow-http-auth - true
  • policy.allow-public - true

Policies
Visible To: Public (No Login Required)
Editable By: Administrators
Pushable By: All Users

VCS Password - Removed

Output:

root@server:/opt/phabricator/bin# GIT_CURL_VERBOSE=1 git clone http://code.exemple.com/diffusion/WFS/wfs.git
Cloning into 'wfs'...
* Couldn't find host code.exemple.com in the .netrc file; using defaults
* About to connect() to code.exemple.com port 80 (#0)
*   Trying 192.168.168.111... * connected
> GET /diffusion/WFS/wfs.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.9.5
Host: code.exemple.com
Accept: */*
Pragma: no-cache

< HTTP/1.1 200 OK
< Date: Tue, 22 Apr 2014 14:10:39 GMT
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.3.10-1ubuntu3.11
< X-Frame-Options: Deny
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
< Content-Length: 264
< Content-Type: application/x-git-upload-pack-advertisement
<
* Connection #0 to host code.exemple.com left intact
* Couldn't find host code.exemple.com in the .netrc file; using defaults
* About to connect() to code.exemple.com port 80 (#0)
*   Trying 192.168.168.111... * connected
> POST /diffusion/WFS/wfs.git/git-upload-pack HTTP/1.1
User-Agent: git/1.7.9.5
Host: code.exemple.com
Accept-Encoding: deflate, gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 174

* upload completely sent off: 174out of 174 bytes
< HTTP/1.1 200 OK
< Date: Tue, 22 Apr 2014 14:10:39 GMT
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.3.10-1ubuntu3.11
< X-Frame-Options: Deny
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< Content-Type: application/x-git-upload-pack-result
<
remote: Counting objects: 104, done.
remote: Compressing objects: 100% (66/66), done.
* remote: Total 104 (delta 30), reused 104 (delta 30)
Connection #0 to host code.exemple.com left intact
Receiving objects: 100% (104/104), 4.25 MiB, done.
Resolving deltas: 100% (30/30), done.
* Closing connection #0

Case 2

  • diffusion.allow-http-auth - true
  • policy.allow-public - true

Policies
Visible To: All Users
Editable By: Administrators
Pushable By: All Users

VCS Password - Set (randomly generated)

Output:

root@server:/opt/phabricator/bin# GIT_CURL_VERBOSE=1 git clone http://code.exemple.com/diffusion/WFS/wfs.git
Cloning into 'wfs'...
* Couldn't find host code.exemple.com in the .netrc file; using defaults
* About to connect() to code.exemple.com port 80 (#0)
*   Trying 192.168.168.111... * connected
> GET /diffusion/WFS/wfs.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.9.5
Host: code.exemple.com
Accept: */*
Pragma: no-cache

* The requested URL returned error: 401
* Closing connection #0
Username for 'http://code.exemple.com': admin
Password for 'http://admin@code.exemple.com':
* Couldn't find host code.exemple.com in the .netrc file; using defaults
* About to connect() to code.exemple.com port 80 (#0)
*   Trying 192.168.168.111... * connected
> GET /diffusion/WFS/wfs.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.9.5
Host: code.exemple.com
Accept: */*
Pragma: no-cache

* HTTP 1.0, assume close after body
< HTTP/1.0 401 You must log in to access this repository.
< Date: Tue, 22 Apr 2014 14:18:07 GMT
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.3.10-1ubuntu3.11
< WWW-Authenticate: Basic realm="Phabricator Repositories"
< Vary: Accept-Encoding
< Content-Length: 46
< Connection: close
< Content-Type: text/html; charset=UTF-8
<
* Closing connection #0
* Issue another request to this URL: 'http://code.exemple.com/diffusion/WFS/wfs.git/info/refs?service=git-upload-pack'
* Couldn't find host code.exemple.com in the .netrc file; using defaults
* About to connect() to code.exemple.com port 80 (#0)
*   Trying 192.168.168.111... * connected
* Server auth using Basic with user 'admin'
> GET /diffusion/WFS/wfs.git/info/refs?service=git-upload-pack HTTP/1.0
Authorization: Basic ***************************
User-Agent: git/1.7.9.5
Host: code.exemple.com
Accept: */*
Pragma: no-cache

* The requested URL returned error: 403
* Closing connection #0
* Couldn't find host code.exemple.com in the .netrc file; using defaults
* About to connect() to code.exemple.com port 80 (#0)
*   Trying 192.168.168.111... * connected
* Server auth using Basic with user 'admin'
> GET /diffusion/WFS/wfs.git/info/refs HTTP/1.1
Authorization: Basic ***************************
User-Agent: git/1.7.9.5
Host: code.exemple.com
Accept: */*
Pragma: no-cache

* The requested URL returned error: 403
* Closing connection #0
error: The requested URL returned error: 403 while accessing http://code.exemple.com/diffusion/WFS/wfs.git/info/refs
fatal: HTTP request failed

I keep getting 403
Any suggestions how to troubleshoot?

What version of Phabricator are you running? (git show in phabricator/)

What do these commands output on your system?

php -r 'echo CRYPT_BLOWFISH;'
php -r 'echo PASSWORD_BCRYPT;'