首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >git-http-后端/nginx-推送错误22

问git-http-后端/nginx-推送错误22
EN

Stack Overflow用户
提问于 2017-10-16 14:09:49
回答 1查看 888关注 0票数 1

我有一个在线服务器(Ubuntu17.04),它可以承载我的裸机。我试图在这个服务器上设置HTTPS,我可以拉,但我不能推,它失败了,有以下错误:

错误:无法访问URL https://user:passwd@myserver.com/REPO/,返回代码22致命:git-http-推失败错误:未能将一些推荐推送到“https://user:passwd@myserver/REPO/”

nginx配置相关部分如下所示:

代码语言:javascript
复制
# 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中缺少user/passwd的本地git配置,但是我设置了这个问题,所以我一无所知。有谁有想法或者看到问题了吗?

编辑:这是我的. .git/config:

代码语言:javascript
复制
[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
EN

回答 1

Stack Overflow用户

发布于 2017-10-16 14:20:16

如果没有重新生成您的安装程序,您是否确定receivepack已根据文档正确启用

如果您试图像在.git/config中一样更新本地这个职位 URL (请看评论),该怎么办?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46772361

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档