GitSmartHTTP for gitolite repositories over Apache 不允许我推送

2024-04-16

我正在设置一个 git-http-backend CGI 脚本来处理我的git.domain子域。服务器位于AWS云上的ELB(弹性负载均衡器)后面。我的服务器配置如下(我的 git 托管由 gitolite 处理):

<VirtualHost *:80>
    ServerName git.domain
    ServerAdmin hjpotter92+git@domain

    #SuexecUserGroup git git                                                                                                                                                                    
    DocumentRoot /opt/gitolite/repositories/

    PerlLoadModule Apache::Authn::Redmine

    SetEnv GIT_PROJECT_ROOT /opt/gitolite/repositories/
    SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER # Have also tried removing this variable
    SetEnv GIT_HTTP_EXPORT_ALL

    ScriptAliasMatch \
        "(?x)^/(.*/(HEAD | \                                                                                                                                                                    
           info/refs | \                                                                                                                                                                        
           objects/(info/[^/]+ | \                                                                                                                                                              
           [0-9a-f]{2}/[0-9a-f]{38} | \                                                                                                                                                         
           pack/pack-[0-9a-f]{40}\.(pack|idx)) | \                                                                                                                                              
           git-(upload|receive)-pack))$" \
        /opt/gitolite/git-core/git-http-backend/$1

    <Directory "/opt/gitolite/git-core">
        AllowOverride None
        Options +ExecCGI -Includes
        Require all granted
    </Directory>
    <Location />
        # enabled in desparation...
        # saw it somewhere in bugzilla powered mailing list
        DAV On

        Order allow,deny
        Require all granted

        AuthType Basic
        AuthName "Git Repositories"
        AuthUserFile /dev/null
        Require valid-user

        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler

        RedmineDSN "DBI:mysql:database=redmine;host=endpoint.rds.amazonaws.com"
        RedmineDbUser "user"
        RedmineDbPass "your"
        RedmineGitSmartHttp yes
    </Location>

    LogLevel info
    CustomLog /var/log/apache2/gitolite.access.log combined
    ErrorLog  /var/log/apache2/gitolite.error.log
</VirtualHost>

我的 apache 服务器是由www-data:www-data用户/组,并且 gitolite 设置为git:git用户/组。为了允许 apache 读/写存储库,我做了:

# usermod -a -G git www-data
// and as a desparate measure, in frustration, the following:
# usermod -a -G www-data git

The PerlAccessHandler并且用户身份验证工作正常,因为我可以使用 redmine 设置中的有效凭据集来克隆我的存储库。

然而,当我试图推动时;我在服务器日志中收到以下内容:

10.0.225.176 [11/Feb/2017:07:46:26 +0530] "GET /xxx.git/info/refs?service=git-upload-pack HTTP/1.1" 401 726 "-" "git/2.11.0"
10.0.225.176 [11/Feb/2017:07:46:27 +0530] "GET /xxx.git/info/refs?service=git-upload-pack HTTP/1.1" 401 725 "-" "git/2.11.0"
10.0.225.176 [11/Feb/2017:07:46:27 +0530] "GET /xxx.git/info/refs?service=git-upload-pack HTTP/1.1" 200 848 "-" "git/2.11.0"
10.0.225.176 [11/Feb/2017:07:46:27 +0530] "POST /xxx.git/git-upload-pack HTTP/1.1" 200 130408 "-" "git/2.11.0"

在客户端(在我在负载均衡器中设置的任何连接超时(30 秒到 10 分钟)后出现以下内容):

Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 930 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 GATEWAY_TIMEOUT
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

很多时候,我也有POST to git-upload-pack长度为 0(对于具有相同提交的同一存储库的同一命令)

10.0.225.222 [11/Feb/2017:07:50:55 +0530] "POST /pandorica.git/git-receive-pack HTTP/1.1" 200 0 "-" "git/2.11.0"
10.0.225.222 [11/Feb/2017:07:53:21 +0530] "POST /pandorica.git/git-receive-pack HTTP/1.1" 200 0 "-" "git/2.11.0"

并在我的服务器错误日志中收到以下内容:

[core:error] [pid 1683] (70007)The timeout specified has expired: [client 10.0.225.176:2534] AH00574: ap_content_length_filter: apr_bucket_read() failed
[cgid:error] [pid 1683] (70007)The timeout specified has expired: [client 10.0.225.176:2534] AH02550: Failed to flush CGI output to client

我什至尝试过 setuid 和 git 用户的 setuid,希望它可以帮助我推送到存储库;但无济于事!

chmod u+s /opt/gitolite/repositories
chmod g+s /opt/gitolite/repositories
// and the same commands for `*.git` inside `repositories`

里面的 git 配置/opt/gitolite/repositories/xyz.git/:

http.postbuffer=200M
core.repositoryformatversion=0
core.filemode=true
core.bare=true
redminegitolite.projectid=xxx
http.receivepack=true
http.uploadpack=true

作为参考,我已经完成了以下各项:

  1. git-http-后端 https://stackoverflow.com/q/7222992/1190388
  2. Apache 和 git-http-backend https://stackoverflow.com/q/25995863/1190388
  3. 如何通过 http 设置 git? https://stackoverflow.com/q/26734933/1190388
  4. 使用 apache 2.4 设置 git-http-backend https://stackoverflow.com/q/40924641/1190388
  5. 使用 git-http-backend.exe 在 Windows 上设置 Git 服务器 https://stackoverflow.com/q/3817478/1190388

如何设置 Apache VHost 以使其开始接受git push.


我花了一段时间。就我而言,这是权限。我将 docker 引擎进程配置为以非 root 身份运行容器。--userns-重新映射

I have

#/etc/subuid 
docker-user:100000:65536

#/etc/subgid 
docker-runner:100000:65536

#/etc/passwd
docker-user:x:90:90::/home/docker-user:/sbin/nologin
dockremap:x:220:220::/home/dockremap:/bin/false
docker-root:x:100000:2::/home/docker-root:/sbin/nologin
docker-daemon:x:100001:2::/home/docker-daemon:/sbin/nologin 

只需使用这个命令:

setfacl -RL -m g:100000:rwx -m g:100002:rwx /var/git 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

GitSmartHTTP for gitolite repositories over Apache 不允许我推送 的相关文章

  • Apache 错误:地址已在使用中:make_sock:无法绑定到地址 [::]:443

    Apache 启动时出错 Address already in use make sock could not bind to address 443 Executing start method lib svc method http a
  • 如何从 apache 中删除日期标头?

    我需要最小化 Apache HTTP 响应标头 现在我将它们减少如下 HTTP 1 1 200 OK Date Thu 25 Mar 2010 21 57 41 GMT Server Apache Content Type text htm
  • 在 Apache 服务器上处理 React Router

    我在重定向 Apache 服务器上 React 生成的 URL 路径的 404 错误时遇到问题 设想 假设我有一些由 React Router 生成的 URL www somewebsite com apps Problem 如果最终用户单
  • 从 URL 中删除文件扩展名

    我从未使用过 mod rewrite 但我想从网站的网址中删除所有文件扩展名 我需要遵循什么规则才能做到这一点 我已经尝试过这个 但是每次我单击网站上的链接时都会出现内部错误 RewriteRule 1 php L Options Mult
  • mod_mono 在新安装的 centos 上出现 EOF 错误

    我全新安装了 Centos 6 3 已完全更新 我已经从源安装了 mono xsp 和 mod mono 每个包都完美编译 它们都以 usr local mono 前缀安装 因此所有内容都位于 usr local mono 下 我已将 In
  • 如何调试没有错误消息的错误?

    如何调试没有错误消息的错误 当加载 PHP 页面时 我在 Firefox 中收到此错误 The connection to the server was reset while the page was loading 除了看起来是 Apa
  • 在 CentOS 6.4 上的 apache 2.0 虚拟主机中创建子域

    我需要在网络服务器上创建子域阿帕奇2 0 CentOS 6 4 PageSpeed Apc 我没有 DNS 服务器 我需要使用虚拟主机 我的代码 NameVirtualHost xx xx xx xx
  • 在同一台服务器上运行两个 PHP 版本

    我在本地服务器上有两个项目 一个项目运行PHP5 6 另一个项目运行PHP7 0 现在可以根据项目启用这两个版本吗 我已经尝试添加AddHandler application x httpd php7 php在 htaccess 项目之一中
  • .htaccess 只允许访问包含文件

    我的网站上有各种子文件夹 我希望用户无法通过 URL 访问它们 但同时我的主要 PHP 文件能够包含它们或将它们用作表单或链接上的操作 我尝试使用 htaccess 与
  • 绕过带index.php和不带index.php的url的htpasswd身份验证

    我已经使用 htaccess 文件添加了 htpasswd 保护进行身份验证 现在我想绕过身份验证www website com and www website com index php其中两个 url 都在访问 index php 文件
  • 无法将 Laravel 应用程序部署到 EC2

    我的 Laravel 项目全部在我的本地主机上运行 我将其部署到 EC2 但没有任何反应 我在开发控制台中看到的只是内部错误 500 我缺少什么 在部署到 AWS 之前我需要更改哪些内容 这是网址 http ec2 52 88 99 75
  • git-http-backend 与 AuthzUnixGroup 无法正常工作

    我正在尝试在 CentOS 6 机器上的 Apache 2 2 上设置一个 git 存储库 并安装了 git 我尝试过许多不同的方向 但我却不知所措 我目前的情况包括能够clone正常 但完全无法推动 似乎我无法使身份验证位正常工作 因为我
  • 将子域重定向到 CakePHP 操作

    背景 我有一个 CakePHP 应用程序 位于 m 我想写一个根级别的 htaccess文件 它将重定向网站的 子域 作为操作的参数 例如 我想编写一个重写规则 这将导致像这样的重定向 http mysite myserver com ht
  • PHP:如何访问根目录之外的下载文件夹? [复制]

    这个问题在这里已经有答案了 我如何创建一个 PHP 脚本 页面 允许会员 买家下载存储在根目录之外的下载文件夹中的压缩文件 产品 我正在使用 Apache 服务器 请帮忙 谢谢 保罗 G 您可能会在 soac 提供的链接中找到一些更好的信息
  • 配置 shiro.ini 以进行 JDBC 连接

    作为我新的一年学习新技术计划的一部分 我开始尝试使用 Apache Shiro 安全框架 我设法让基本示例正常工作 该示例将用户名 密码和角色存储在 shiro ini 文件中 但是当我修改 shiro ini 文件以使用 JDBC 时 它
  • Tomcat 托管具有多个 SSL 证书的多个虚拟主机

    例如 我有一台使用 Tomcat 7 托管多个网站的服务器 a abc com b abc com c def com d def com 使用tomcat的虚拟主机功能 因此它们各自可能属于不同的webapps文件夹 我们现在正在尝试为每
  • SSE(EventSource):为什么不超过6个连接?

    我想看看在我的机器超载之前我可以设置多少个并发 SSE 又名 EventSource 连接 但使用 Firefox Firefox 18 或 Firefox 20 进行测试时 它在 6 个连接处停止 附加连接没有给出错误 但不发送任何数据
  • 为什么有人将(Apache mod_expires 参数)ExpiresByType 设置为“访问加 0 秒”?

    在审查答案时这个帖子 https stackoverflow com questions 9933012 how to use mod headers and mod expires to cache 我不明白为什么这里使用 0 秒作为最佳
  • 从 Apache 运行 python 脚本的最简单方法

    我花了很长时间试图弄清楚这一点 我基本上正在尝试开发一个网站 当用户单击特定按钮时 我必须在其中执行 python 脚本 在研究了 Stack Overflow 和 Google 之后 我需要配置 Apache 以便能够运行 CGI 脚本
  • 将代码从 htaccess 重写为 nginx 配置?

    我在将 htaccess 文件中的重写代码实现到 nginx 配置中时遇到问题 我已经尝试过生成器 http winnginx com htaccess http winginx com htaccess用于生成我的重写 代码 我的ngin

随机推荐