The requested url returned error 502 git

Does anyone know what the problem seems to be with git? I am getting this error when running running a git clone to clone from team foundation server (tfs). fatal: unable to access 'http://websi...

Does anyone know what the problem seems to be with git?
I am getting this error when running running a git clone to clone from team foundation server (tfs).

 fatal: unable to access 'http://website.com/_git/project': The requested URL returned error: 502

slal's user avatar

slal

2,57717 silver badges28 bronze badges

asked Jun 16, 2017 at 16:53

Kevin Cai's user avatar

4

For reference: Within a corporate environment behind an authenticating proxy server I had previously edited my git global config an override for the proxy server. Once I corrected this, I was able to connect.

Useful command:

git config --global --list


[filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true
[user]
        name = GuyWicks
[user]
        email = guy.wicks@iworkhere.com
[http]
    proxy = http://public-cache:8080

[https]
    proxy = http://public-cache:8080

I commented out the four proxy lines (#)

answered May 9, 2018 at 15:38

Guy's user avatar

GuyGuy

9,6607 gold badges37 silver badges42 bronze badges

This took me considerable amount of time to troubleshoot and fix this annoying issue.

In my case I had the http_proxy and https_proxy environment variables set on my PC. ( You can find them under control panel — System and Security — Advanced system settings — Env variables — System variables section bottom panel in windows 10)

Once I deleted those 2 environment variables ( highlight — delete — ok ) and closed the Git-Terminal window and re-opened it the problem (http 502) went away. Just to confirm I tested with Git GUI + VS Code + Git Term. Did git fetch/clone/push/etc …

Note: I am in a corporate env behind a strict proxy but so is the Enterprise tfs URL therefore I do not need a proxy interfering between me and my tfs server. I suspect (cannot confirm or rule out) the proxy was playing a MITM. Client machine is Windows 10 latest build running git version 2.22.0.windows.1

answered Jul 6, 2019 at 5:22

objectNotFound's user avatar

objectNotFoundobjectNotFound

1,6231 gold badge18 silver badges24 bronze badges

I was running into the same issue. For some reason I had http and Https proxies set up in my git config list. Removing those allowed me to clone successfully.

answered Sep 10, 2018 at 20:24

Yuvraj's user avatar

YuvrajYuvraj

711 silver badge2 bronze badges

0

I have also met this issue when cloning a project from our private gitlab repo. Initially I am using the following command:

git clone http://remote_gitlab_url/user_name/some_projects

I am seeing the following error:

The requested URL returned error: 502

After adding .git to the project name, everything works smoothly:

git clone http://remote_gitlab_url/user_name/some_projects.git

answered Jan 7, 2021 at 8:24

jdhao's user avatar

jdhaojdhao

21.8k14 gold badges125 silver badges251 bronze badges

Like @netlander the workaround of bypassing the Apache proxy worked for me. It was crashing at that step: «POST git-receive-pack (7200216 bytes)», but this works normally without the proxy.

Might well be related to the 401: with the Apache mod_proxy, I did not receive an authentication request, but I received one without the proxy and had to type user/password for the commit to be accepted.

Apache error log (multiple identical lines):

[Sat Jan 12 09:12:33.710124 2019] [proxy:error] [pid 25787] (32)Broken pipe: [client 37.58.212.212:59962] AH01084: pass request body failed to 127.0.0.1:3000 (127.0.0.1)
[Sat Jan 12 09:12:33.710162 2019] [proxy_http:error] [pid 25787] [client 37.58.212.212:59962] AH01097: pass request body failed to 127.0.0.1:3000 (127.0.0.1) from 37.58.212.212 ()

Gogs log/hooks/post-receive.log (9:20 is without the proxy, nothing visible at 9:12 with the proxy):

2019/01/12 09:20:41 [ERROR] [...ogs/models/action.go:493 CommitRepoAction()] UpdateIssuesCommit: invalid issue reference [ref: 09/01/2019]

Other log/hooks/* files are touched but empty

Portion of the log/gogs.log which appears relevant, without the proxy:

2019/01/12 09:20:41 [TRACE] HTTPGit - Authenticated user: fgm
2019/01/12 09:20:41 [TRACE] Session ID: d8376360d674a0ea
2019/01/12 09:20:41 [TRACE] CSRF Token: FKyzeZELo1j4eoGE-TKp3yDmyc06MTU0NzI4NDg0MTU0MjMxMjM2MA==
2019/01/12 09:20:41 [TRACE] Detected encoding: UTF-8 (fast)
2019/01/12 09:20:41 [TRACE] Template: repo/home
2019/01/12 09:20:41 [TRACE] Session ID: 9e0fc1184eb4970b
2019/01/12 09:20:41 [TRACE] CSRF Token: M0fhCH0kbQAhgfPKdmaXSga1DPk6MTU0NzI4NDg0MTkxMjIwMDAwOA==
2019/01/12 09:20:41 [TRACE] TriggerTask 'assets__prague2013_blocks/blocks-1-8' by 'fgm'
2019/01/12 09:20:41 [TRACE] DeliverHooks [repo_id: 112]
2019/01/12 09:20:41 [TRACE] AddTestPullRequestTask [head_repo_id: 112, head_branch: blocks-1-8]: finding pull requests
2019/01/12 09:20:41 [TRACE] AddTestPullRequestTask [base_repo_id: 112, base_branch: blocks-1-8]: finding pull requests

More interestingly, updating my HTTPS Vhost to look like this, as suggested on https://httpd.apache.org/docs/2.4/en/mod/mod_proxy.html#envsettings , fixed the issue for me. It causes the browser to ask for credentials (triggering keychain access in macOS), and succeeds:

  ProxyPreserveHost On
  ProxyRequests off
  ProxyPass / http://127.0.0.1:3000/
  ProxyPassReverse / http://127.0.0.1:3000/
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1

This might suggest a problem with HTTP/1.1 keepalive handling in Gogs or its dependencies.

I am trying to setup a server where my git repo would be accessible with HTTP(S).

I am using gitolite and nginx (and gitlab for web interface but I doubt it makes any difference).

I have searched the whole afternoon and I think I’m stuck.

I have think I have understood that nginx needs fcgiwrap to work with gitolite, so I tried several configurations, but none of them work.

My repositories are at /home/git/repositories.

Here’s the three nginx configurations I have tried.

1:

   location ~ /git(/.*) {
       gzip off;
       root /usr/lib/git-core;

       fastcgi_pass  unix:/var/run/fcgiwrap.socket;
       include /etc/nginx/fcgiwrap.conf;

       fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
       fastcgi_param DOCUMENT_ROOT /usr/lib/git-core/;
       fastcgi_param SCRIPT_NAME git-http-backend;

       fastcgi_param GIT_HTTP_EXPORT_ALL "";
       fastcgi_param GIT_PROJECT_ROOT /home/git/repositories;
       fastcgi_param PATH_INFO $1;
       #fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    }

Result:

> git clone http://myservername/projectname.git test/
Cloning into test...
fatal: http://myservername/projectname.git/info/refs not found: did you run git update-server-info on the server?

and

> git clone http://myservername/git/projectname.git test/
Cloning into test...
error: The requested URL returned error: 502 while accessing http://myservername/git/projectname.git/info/refs
fatal: HTTP request failed

2:

   location ~ /git(/.*) {
        fastcgi_pass  localhost:9001;
        include       /etc/nginx/fcgiwrap.conf;
        fastcgi_param SCRIPT_FILENAME     /usr/lib/git-core/git-http-backend;
        fastcgi_param GIT_HTTP_EXPORT_ALL "";
        fastcgi_param GIT_PROJECT_ROOT    /home/git/repositories;
        fastcgi_param PATH_INFO           $1;
    }

Result:

> git clone http://myservername/projectname.git test/
Cloning into test...
fatal: http://myservername/projectname.git/info/refs not found: did you run git update-server-info on the server?

and

> git clone http://myservername/git/projectname.git test/
Cloning into test...
error: The requested URL returned error: 502 while accessing http://myservername/git/projectname.git/info/refs
fatal: HTTP request failed

3:

location ~ ^.*.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx))$ {
    root /home/git/repositories/;
  }

  location ~ ^.*.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
    root /home/git/repositories;

    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    fastcgi_param SCRIPT_FILENAME   /usr/lib/git-core/git-http-backend;
    fastcgi_param PATH_INFO         $uri;
    fastcgi_param GIT_PROJECT_ROOT  /home/git/repositories;  
    include /etc/nginx/fcgiwrap.conf;
  }

Result:

> git clone http://myservername/projectname.git test/
Cloning into test...
error: The requested URL returned error: 502 while accessing http://myservername/projectname.git/info/refs
fatal: HTTP request failed

and

> git clone http://myservername/git/projectname.git test/
Cloning into test...
error: The requested URL returned error: 502 while accessing http://myservername/git/projectname.git/info/refs
fatal: HTTP request failed

Also note that with any of those configurations, when I try to clone with a project name that actually doesn’t exist, I get a 502 error.

Does anyone already succeeded in doing this? What am I doing wrong?

Thanks.

UPDATE:

nginx error log file said:

2012/04/05 17:34:50 [crit] 21335#0: *50 connect() to unix:/var/run/fcgiwrap.socket failed (13: Permission denied) while connecting to upstream, client: 192.168.12.201, server: myservername, request: "GET /git/oct_editor.git/info/refs HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "myservername"

So I changed permissions for /var/run/fcgiwrap.socket, and now I have :

> git clone http://myservername/git/projectname.git test/
Cloning into test...
error: The requested URL returned error: 403 while accessing     http://myservername/git/projectname.git/info/refs
fatal: HTTP request failed

Here is the error.log file I have now:

2012/04/05 17:36:52 [error] 21335#0: *78 FastCGI sent in stderr: "Cannot chdir to script directory (/usr/lib/git-core/git/projectname.git/info)" while reading response header from upstream, client: 192.168.12.201, server: myservername, request: "GET /git/projectname.git/info/refs HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "myservername"

I keep on investigating.

Понравилась статья? Поделить с друзьями:
  • The project you are opening contains compilation error unity
  • The ole db provider bulk for linked server null reported an error
  • The nvidia opengl driver has encountered an out of memory error
  • The mesh is partially hidden как исправить
  • The legend of the bone sword rpg error room