- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我想通过“智能”HTTP 获得 git 存储库,只有我可以推送到它,但任何人(或任何拥有帐户的人)都可以从中克隆/获取。
在 git-http-backend(1) 联机帮助页中,可以找到 Apache Web 服务器的以下示例配置:
Ensure mod_cgi, mod_alias, and mod_env are enabled, set GIT_PROJECT_ROOT (or DocumentRoot) appropriately, and create a ScriptAlias to the CGI:
SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/To enable anonymous read access but authenticated write access, require authorization with a LocationMatch directive:
<LocationMatch "^/git/.*/git-receive-pack$">
AuthType Basic
AuthName "Git Access"
Require group committers
#...
</LocationMatch>
不幸的是,这个配置不起作用。我可以毫无问题地获取/克隆存储库,无需身份验证,但推送失败:
$ git push origin master
error: Cannot access URL http://localhost/git/test.git/, return code 22
fatal: git-http-push failed
检查 Apache Web 服务器的 error.log
没有帮助:
[...] Service not enabled: 'receive-pack'[...] Request not supported: '/var/www/git/test.git/'
access.log
告诉我们 git push
首先在 /git/test.git/info/refs?service=git-receive 上使用 GET 方法-pack
基于查询的 URL,不在 LocationMatch 指令中:
[...] "GET /git/test.git/info/refs?service=git-receive-pack HTTP/1.1" 403 304 "-" "git/1.7.10.4"[...] "GET /git/test.git/info/refs HTTP/1.1" 200 267 "-" "git/1.7.10.4"[...] "GET /git/test.git/HEAD HTTP/1.1" 200 337 "-" "git/1.7.10.4"[...] "PROPFIND /git/test.git/ HTTP/1.1" 404 250 "-" "git/1.7.10.4"
(以下几行是关于回退到“愚蠢的”基于 WebDAV 的 HTTP 推送 - 是否可以禁用此回退?)。
现在我使用以下解决方法:我需要有效的用户来获取和推送(使用 git-http-backend(1) 联机帮助页中“读取和写入的身份验证”示例的修改配置),并通过 pre 将推送限制为单个用户-通过检查
hook。REMOTE_USER
环境变量接收
最佳答案
一个不太复杂的替代方法是使用 gitolite除了你的 Apache-git 设置。
您可以轻松地将 gitolite 插入 Apache(无需 ssh 配置)。
参见示例:httpd.conf , 结合这个本地 gitolite installation script .
然后您可以轻松地声明 Apache 登录名用于写访问,并声明 @all
用于读访问。
关于git - 如何通过 http 启用对 git 存储库的匿名读取访问( pull )但经过身份验证的写入访问(推送)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13792391/
有没有办法 git pull 直到有东西可以 pull 。 假设我正在等待一位同事推送他的最新更改,因为我不耐烦并且没有看他的屏幕,我只是运行 watch git pull 直到我看到有东西被 pul
这个问题在这里已经有了答案: What is the difference between 'git pull' and 'git fetch'? (37 个答案) 关闭 6 年前。 这个问题我一直
我有一个分支,想使用 $ git pull origin master 将 master 中的更改 git在我这样做之后, pull 确实没有显示任何 merge 的 PR 被 pull 并且说它已经
在各个地方,寻找有关如何从 GitHub merge 请求创建本地分支的说明,我看到了两个版本: git fetch upstream refs/pull/PR_ID/head:NEW_LOCAL_B
我已经在github上创建了一个仓库。 Upstream中有一些新的 pull 请求。我想从本地上游 pull 请求。 我怎样才能做到这一点?我不知道,没有发现任何与此相关的信息。 最佳答案 通过首先
假设我 fork 一个 GitHub 项目并进行一些更改,然后为要 merge 到的更改创建 pull 请求我从中 fork 的原始项目。 一旦我这样做了,如果我返回到我的 fork 项目并提交更多文
我在 BitBucket 上有一个 Git 存储库。我有两个分支 master 和 db。在我的笔记本电脑上,我对 db 进行了更改,提交了更改并推送到 BitBucket。我可以在该分支中看到提交。
我在分支 tm-skeleton并执行 git pull 做某事(从技术上讲,它要求输入密码,然后我在那里点击了 ),但我怎么知道它从哪里 pull ?通常,[branch "tm-skeleton"
我们在组织中使用 Github 进行源代码控制。多个开发人员不断地将他们的更改 merge 到远程源存储库。就我而言,我在两周前克隆了存储库,之后进行了多次 merge 。现在我正在尝试获取代码的最新
在 merge pull 请求之前,我想在本地快速 pull 请求并运行测试并测试一些内容。我还不想点击 gihub merge pull 请求。 我认为滑轮会有所帮助 http://ejohn.or
我有一个服务器,其中有一些我不知道我在哪里的配置我只是 git pull 并获取 github 存储库中的内容,然后重新启动它以进行部署。 问题是,有一个不是我最新的提交,它实际上不在我的服务器上。这
我是 Git 的新手,所以如果这是微不足道的,我深表歉意。我有一个使用 Github 和 EGit 设置的私有(private)存储库. 要更新并 merge 我的本地存储库分支与远程版本(本质上是g
pull 请求的发起者可能 give the maintainer the ability to edit the pull request . 对于任何给定的 pull 请求,我们如何判断该能力是否
我 fork 了一个GitHub存储库,并在 fork 上进行了一些更改,然后提交了一个 pull 请求,但是原始GitHub存储库的所有者要求对它们进行 pull 请求中的一些更改。我以为在fork
如何使用 Git GUI 工具进行拉取?似乎任何地方都没有 pull 命令。 是否有使用 Git GUI 的等效菜单选项? 任何帮助将不胜感激。 最佳答案 嗯,我发现这个有用的论坛帖子: https:
我制作了一个程序来从我的 github 上托管的公共(public)存储库中提取数据。克隆一个项目工作得很好(无论如何我都是这样做的),但我一直在努力让它工作以提取所有内容,一旦你删除一个文件,它不再
哪个比另一个更可取,为什么?如果我在提交之前 pull ,其他开发人员所做的更改是否与我当前正在处理的内容 merge ?如果是这样,那意味着这个更可取? 最佳答案 最好先提交。 pull 而不提交可
我对使用 git 在团队中工作还很陌生。 我从“origin/master”开始。 首先我创建了一个新分支feature/26062018-offline-seite_ef。 我添加了提交。 我检查了
这个问题在这里已经有了答案: Retrieve specific commit from a remote Git repository (11 个答案) 关闭 9 年前。 我在本地创建一个空的新存
我开始在 Github 上使用新的 pull 请求草案功能,但我想知道在我不小心发出 pull 请求的情况下是否可以将合法的 pull 请求转换回 pull 请求草案。 最佳答案 如前所述on Twi
我是一名优秀的程序员,十分优秀!