1

I am new to setting up an Git repository via http with Nginx (not Apache) I found this guide, it seemed a very simple solution.

I was able to create a repository and use git clone commands, however when i try to push changes to remote repository, I got following message from client

#git push origin master
XML error: not well-formed (invalid token)
error: no DAV locking support on http://192.168.80.128/git/it-knowledge.git/
fatal: git-http-push failed

Could anyone help me to figure out what mistakes I made ? About DAV locking support, I searched and see some threads about DAV locking file with Apache, is there any equivalent configuration on NginX in order to push changes successfully ?

Below are my nginx configuration file for the git path, my nginx was already installed with --with-http_dav_module option

server {
    listen       80;
    server_name  192.168.80.128;
    client_body_temp_path /tmp/client_temp;
    location ~ /git(/.*) {
        dav_methods PUT DELETE MKCOL COPY MOVE;
        create_full_put_path  on;
        dav_access  user:rw group:rw all:rw;
        autoindex  on;
        client_max_body_size  10G;
        fastcgi_pass  localhost:9000;
        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    /srv/git;
        fastcgi_param PATH_INFO           $1;
    }
}

1 Answer 1

0

That guide refers to a 2010 article.
A similar configuration is in this gist

location ~ /git(/.*) {
    # Set chunks to unlimited, as the body's can be huge
    client_max_body_size            0;

    fastcgi_param   SCRIPT_FILENAME     /usr/lib/git-core/git-http-backend;
    include     fastcgi_params;
    fastcgi_param   GIT_HTTP_EXPORT_ALL "";
    fastcgi_param   GIT_PROJECT_ROOT    /git;
    fastcgi_param   PATH_INFO       $1;

    # Forward REMOTE_USER as we want to know when we are authenticated
    fastcgi_param   REMOTE_USER     $remote_user;
    fastcgi_pass    unix:/var/run/fcgiwrap.socket;
}

Make sure your repos are in ~, and that /usr/lib/git-core/git-http-backend does exists (with a recent enough Git version)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.