git-http-backend/nginx - 推送错误22

问题描述:

我有一个在线服务器(Ubuntu 17.04),托管我的裸回购。我试图建立HTTPS此服务器上,我可以拉,但我不能推时,出现以下错误:git-http-backend/nginx - 推送错误22

error: Cannot access URL https://user:[email protected]/REPO/ , return code 22 fatal: git-http-push failed error: failed to push some refs to ' https://user:[email protected]/REPO/ '

nginx的配置相关的部分看起来像这样:

# static repo files for cloning over https 
location ~ ^.*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx))$ { 
    client_max_body_size 0; 
    auth_basic "Restricted Area"; 
    auth_basic_user_file /etc/apache2/.htpasswd; 
    fastcgi_param REMOTE_USER $remote_user; 
    root /home/git/; 
} 

# requests that need to go to git-http-backend 
location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ { 
    client_max_body_size 0; 
    auth_basic "Restricted Area"; 
    auth_basic_user_file /etc/apache2/.htpasswd; 
    root /home/git/; 

    #fastcgi_pass unix:/var/run/fcgiwrap.socket; 
    fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; 
    fastcgi_param PATH_INFO   $uri; 
    fastcgi_param GIT_PROJECT_ROOT /home/git/; 
    fastcgi_param GIT_HTTP_EXPORT_ALL ""; 
    fastcgi_param REQUEST_METHOD $request_method; 
    fastcgi_param REMOTE_USER $remote_user; 
    include fastcgi_params; 
} 

在我读的所有线程中,REMOTE_USER的fastcgi参数或者缺少远程URL中的用户/密码的本地git配置都出现问题,但是我设置了这个,所以我很无能。有没有人有想法或看到问题?

编辑:这是我的.git /配置:

[core] 
    repositoryformatversion = 0 
    filemode = false 
    bare = false 
    logallrefupdates = true 
    symlinks = false 
    ignorecase = true 
[remote "origin"] 
    url = https://user:[email protected]/REPO/ 
    fetch = +refs/heads/*:refs/remotes/origin/* 
[branch "master"] 
    remote = origin 
    merge = refs/heads/master 
[user] 
    name = git 

没有重现你的设置,你确定receivepack正确启用,根据documentation

如果你尝试在this post更新本地.git/config URL喜欢(看注释)

+0

我已经更新了我的.git /配置(查看错误,用户名是在URL) 和receivepack什么是默认启用认证用户和禁用匿名这就是我想要的 – Krapow

+0

好吧,那么nginx fastcgi_params,它覆盖了之前定义的参数的任何机会? 我不确定git push -v是否提供了使用HTTP而不是SSH的有用信息,但可以试一试。 我会尝试看看我是否可以重现您的设置。 – lovethebomb

+0

也是为了以防万一,你能否更新你的问题并添加你的repo'.git/config'? – lovethebomb