2017-10-16 150 views
0

我有一個在線服務器(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 

回答

0

沒有重現你的設置,你確定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