Score:0

fatal: repository not found (git + http + nginx + fastcgi)

ch flag

I am trying to serve git repositories using Nginx. I have the following configuration for Nginx server:

worker_processes  auto;

error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {

}


http {
    include /etc/nginx/mime.types;


log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log  main;

server {
    listen80;
    root  /home/path/to/repositories;
 
    location ~ \.git {

        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/.gitpasswd;
                                
        include fastcgi_params; 
        fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
        fastcgi_param GIT_PROJECT_ROOT /home/path/to/repositories;
        fastcgi_param GIT_HTTP_EXPORT_ALL "";
        fastcgi_param PATH_INFO $uri;
        fastcgi_param REMOTE_USER $remote_user;
        client_max_body_size            0;

        fastcgi_pass  unix:/var/run/fcgiwrap.socket; 
    }

}

}

But when i try to clone it in a folder with the following command:

git clone http://user:password@my-local-ip/repo-name.git folder-name

I get the following result:

Cloning into 'folder-name'...
fatal: repository 'http://my-local-ip/repo-name.git/' not found

But the repository is there! I can serve it through "dumb http" with:

location /repositories {
            root  /home/path/to;
        }

've checked the error.log of nginx and when I try to clone with "smart HTTP" I get:

2022/12/05 17:09:22 [error] 79488#79488: *43 FastCGI sent in stderr: "Not a git repository: '/home/path/to/repositories/repo-name.git'" while reading response header from upstream, client: 192.168.1.13, server: , request: "GET /repo-name.git/info/refs?service=git-upload-pack HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "192.168.1.13"
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.