简体   繁体   English

git daemon-如何更新克隆的repo>?

[英]Git-daemon - how does one update cloned repo>?

I need allow anon access to a few repos. 我需要允许匿名访问一些存储库。 I read a few how-tos and docs on git-daemon that use the git clone clone --bare approach and serve the cloned repo, with git-daemon. 我在git-daemon上阅读了一些使用git clone clone --bare方法并为git-daemon提供服务的克隆git clone clone --bare how-tos和文档。 This works fine, installed it via aptitude and it runs merrily as a service in /etc/srv/git-daemon. 可以正常运行,可以通过aptitude安装它,并且可以在/ etc / srv / git-daemon中作为服务正常运行。

My question is, once devel has more commits, how do you update and sync the cloned instance being used as public repository? 我的问题是,一旦devel有更多提交,您如何更新和同步用作公共存储库的克隆实例?

Also, this repo is also writable it seems (obvious, but surely not always wanted), is it possible to make git-daemon serve read-only? 另外,这个仓库看起来也是可写的(显而易见,但肯定不是一直想要的),是否有可能使git-daemon以只读方式提供?

For making a repository read-only for all, writable only for some users, the easiest way would be to add an authorization layer like gitolite . 为了使存储库对所有人都是只读的,仅对某些用户可写,最简单的方法是添加一个授权层,gitolite

You can plug it in to a gitweb, or just to an http(s) access, like I do in this Apache configuration , which can be setup for requiring an authentication. 您可以将其插入gitweb或仅访问http(s)访问,就像我在此Apache配置中所做的那样,可以将其设置为需要身份验证。

So you can keep your current git-daemon, for read-only access, but you can add an (authenticated) https access for write purpose, allowing you to control precisely who can do what to which repos (through gitolite). 因此,您可以保留当前的git-daemon,以进行只读访问,但是可以出于写入目的添加(已认证的)https访问,从而使您可以精确地控制谁可以(通过gitolite)对哪些存储库执行操作。

You will also be able to add a post-receive hook to your writable upstream repo, in order for that hook to cd to the other read-only repo, and do a git fetch . 您还可以添加一个post-receive该钩勾到你的可写上游回购,为了cd其他只读回购,并做一个git fetch

#!/bin/bash
export GIT_DIR=/path/to/bare/read-only-repo.git/
cd $GIT_DIR
git fetch --all

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM