I have a Debian running Nginx on git.example.com
which I use to store git repositories.
I can pull/push/clone via SSH by running git clone [email protected]/git/my_repo
. (git
is a symlink in my home directory which points to /mnt/primary_storage/git
)
However, when I clone/pull with HTTP(S) I get the following error:
fatal: http://git.example.com/my_repo.git/info/refs not valid: is this a git repository?
I get this error regardless of whether I am cloning a real repository
The relevant part of the Nginx config is:
server {
listen 80;
server_name git.example.com;
root /mnt/primary_storage/git;
location ~ (/.*) {
auth_basic "Login";
auth_basic_user_file /mnt/primary_storage/.htpasswd;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /mnt/primary_storage/git;
fastcgi_param PATH_INFO $1;
fastcgi_pass localhost:9000;
}
}
The annoying thing is that I had the exact same setup running on another server which had Ubuntu and it worked fine. So I don’t know what is causing this. Apart from this one problem everything on the server is running fine.
Yes there are a few similar questions like this on StackExchange sites but none are helping me. For example some of them are dealing with Github and they hadn’t set up the repository first. Others had the Git address wrong. And Others said I should run git config --global http.proxy
which didn't help.
Also I have triple checked all of the folder/file permissions and they are all readable and writable from the Nginx user.