2017-02-26 75 views
1

我是使用Nginx(不是Apache)通過http建立Git存儲庫的新手 我發現this guide,它似乎是一個非常簡單的解決方案。未能通過Nginx通過http代理推送對git存儲庫的更改

我能夠創建一個存儲庫並使用git clone命令,但是當我嘗試更改推到遠程存儲庫中,我得到了下面的客戶端消息

#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 

誰能幫我找出什麼錯誤我製作 ? 關於DAV鎖定支持,我搜索並查看了有關DAV鎖定文件的一些線程,是否有任何Nginx上的等效配置,以便成功推送更改?

下面是git的路徑我nginx的配置文件,我的Nginx已經安裝了--with-http_dav_module選項

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; 
    } 
} 

回答

0

該指南是指2010 article
類似的配置是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; 
} 

確保您的回購協議是~,而且/usr/lib/git-core/git-http-backend不存在(有足夠新的Git版本)