Git returns fatal: git-http-push failed Git returns fatal: git-http-push failed nginx nginx

Git returns fatal: git-http-push failed


The answer to this question is PATH_INFO was expecting $uri not $remote_uri

Replacing:

fastcgi_param PATH_INFO $request_uri;

with

fastcgi_param PATH_INFO $uri;

Fixed the problem. I also added fastcgi_param REMOTE_USER $remote_user; as I was using http authentication.

So it should look like this:

# Gitserver {    listen 80;    listen 443 ssl;    server_name git.myserver.org;    access_log  /home/admin/repo.deploy.log combined;    ssl_certificate /etc/nginx/git.myserver.org.self.crt;    ssl_certificate_key /etc/nginx/git.myserver.org.self.key;    location / {        auth_basic  "Restricted";        auth_basic_user_file /etc/nginx/nginx.htpasswd;        include fastcgi_params;        fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;        fastcgi_param GIT_HTTP_EXPORT_ALL "";        fastcgi_param GIT_PROJECT_ROOT /home/admin/repo/;        fastcgi_param PATH_INFO $uri;        fastcgi_param REMOTE_USER $remote_user;        fastcgi_pass 127.0.0.1:9001;    }}