Git   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了我怎么能允许通过HTTP匿名推送到一个Git仓库?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

在这里找不到示例: http : //www.kernel.org/pub/software/scm/git/docs/git-http-BACkend.html

可能吗?

PHP 5.3.8,JSON和CentOS 6

Apache的多个虚拟主机在相同的IP(不同的url)

如何在java中调用axis apache客户端

用mod_rewrite重写用户代理的规则

Zend和.htaccess

添加你的httpd.conf(假设/ srv / git包含你的回购)

<Directory "/usr/lib/git-core*"> Order allow,deny Allow from all </Directory> SetEnv GIT_PROjeCT_ROOT /srv/git SetEnv GIT_http_EXPORT_ALL ScriptAlias /git/ /usr/lib/git-core/git-http-BACkend/

然后确保apache可以写入你的版本库目录(从里面的repo运行这个地方http你的apache用户

chown -R http .

在服务器上创建的存储库中打开.git / config添加以下内容

[http] receivepack = true

最后在版本库的根目录下运行

git config --bool core.bare true

或者,如果你想要一个服务器上的文件(对于网站或其他),然后忽略上述命令,并编辑.git / config这个

[receive] denyCurrentBranch = false

然后在服务器上运行,当你想更新目录(必须有更好的方式,请让我知道)

git reset --hard

使用git-http-BACkend和gitweb进行匿名推送和浏览

请注意,自从git 1.6.6以来,DAV比新的“smart-http支持慢得多。 新的方法允许整个包立即传输,而不是作为单个文件

下面的设置消除了每个回购(http.receivepack)中需要自定义配置,或者需要硬重置。 只要让每个新的重新[宝

git --bare init --shared

YOu还可以使用gitweb在同一位置提供可显示的URL。

注意:由于访问由apache控制,因此您可以将任何Auth要求(htaccess或ldap等)添加到每个存储库的设置中。

只需创建一个新的git_support.conf文件,并将其包含在apache中(在httpd.conf中添加include语句)

# # Basic setup for git-http-BACkend # SetEnv GIT_PROjeCT_ROOT /opt/git_repos SetEnv GIT_http_EXPORT_ALL SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER #IMportant !!! This Could be your problem if missing <Directory /opt/git> # both http_BACkend and gitweb should be somewhere under here AllowOverride None Options +ExecCGI -Includes #Important! Lets apache execute the script! Order allow,deny Allow from all </Directory> # This pattern matches git operations and passes them to http-BACkend ScriptAliasmatch "(?X)^/git/(.*/(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/git/libexec/git-core/git-http-BACkend/$1 # Anything not matched above goes to displayable gitweb interface ScriptAlias /git /opt/git/cgi-bin/gitweb.cgi/

结果是推/拉的能力:

@H_746_0@me@machine /tmp/eddies $ git pull Already up-to-date. me@machine /tmp/eddies $ touch changedFile me@machine /tmp/eddies $ git add . me@machine /tmp/eddies $ git commit -am"commiTing change" [master ca7f6ed] commiTing change 0 files changed,0 insertions(+),0 deletions(-) create mode 100644 changedFile me@machine /tmp/eddies $ git push origin master CounTing objects: 3,done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2),done. WriTing objects: 100% (2/2),239 bytes,done. @R_94_10586@l 2 (delta 1),reused 0 (delta 0) To http://mysecretdomain.com/git/eddies 0f626a9..ca7f6ed master -> master

你可以在网上浏览这些变化

我怎么能允许通过HTTP匿名推送到一个Git仓库?

资料来源: http : //repo.or.cz/w/alt-git.git?a= blob_plain; f= gitweb/ README

只是不要把任何AuthType放在你的Apache配置中(所以没有LOCATIOnMatch或LOCATIOn元素)。

如果你没有AuthType,那就意味着你的Apache只会把你的git请求传递给cgi程序git-http-BACkend 。

@H_616_78@

所以在这种情况下不会进行身份验证:匿名推送将成为可能。

大佬总结

以上是大佬教程为你收集整理的我怎么能允许通过HTTP匿名推送到一个Git仓库?全部内容,希望文章能够帮你解决我怎么能允许通过HTTP匿名推送到一个Git仓库?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: