【发布时间】:2017-10-16 14:09:49
【问题描述】:
我有一个在线服务器 (Ubuntu 17.04) 来托管我的裸存储库。我尝试在此服务器上设置 HTTPS,可以拉取但无法推送,失败并出现以下错误:
错误:无法访问 URL https://user:passwd@myserver.com/REPO/, 返回代码 22 致命:git-http-push 失败错误:未能推送一些 参考'https://user:passwd@myserver/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;
}
在我阅读的所有线程中,问题来自远程 URL 中缺少用户/密码的 REMOTE_USER fastcgi 参数或本地 git 配置,但我设置了它,所以我一无所知。有没有人有想法或发现问题?
编辑:这是我的 .git/config:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://user:passwd@myserver.com/REPO/
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
name = git
【问题讨论】:
标签: git nginx git-http-backend