我怎么能允许匿名推一个Git仓库通过http? [英] How can I allow anonymous push to a git repository over http?

查看:247
本文介绍了我怎么能允许匿名推一个Git仓库通过http?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能在这里找到一个示例:
http://www.kernel.org/pub /software/scm/git/docs/git-http-backend.html

I cannot find an example here: http://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html

这可能吗?

推荐答案

添加到您的httpd.conf(假设/ SRV / git的包含您的回购)

Add this to your httpd.conf (Assuming /srv/git contains your repos)

<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可以写信给你的资料库目录(从回购来看这其中http是你的Apache用户内部)

Then make sure apache can write to your repository directory (from inside repo run this where http is your apache user)

chown -R http .

在你的服务器上创建的存储库开辟的.git / config并添加以下

In the repository you have created on the server open up .git/config and add the following

[http]
    receivepack = true

终于在库根运行

git config --bool core.bare true

另外,如果你想有一个服务器(一个网站或其他)上可用的文件,然后忽略上面的命令和编辑的.git /配置本

[receive]
    denyCurrentBranch = false

,然后当你要更新的目录服务器上运行此(必须有一个更好的办法,所以请让我知道)

and then run this on the server when you want to update the dir (there must be a better way so please let me know)

git reset --hard

这篇关于我怎么能允许匿名推一个Git仓库通过http?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆