git:禁止意外地将合并测试推送到master中
gitosis 中有一些存储库(每个独立模块一个),
两个分支:master(生产从该分支接收更新)和测试
任务:对于每个存储库,拒绝尝试搞砸 master 分支: 禁止将测试推送到主合并
情况:最近从 svn 迁移到 git
每个人都有本地克隆和一个本地分支,用于他将其合并到测试中的每个错误
(我们的集成分支) ,然后,如果 qa 批准,则部署(合并到 master 并推送)
不多的人力,就像每个存储库中有一个最活跃的人
知道那里发生了什么 - 他是一个 git 新手,就像我一样
我们需要集中集成分支并准备好尽快使用生产分支,但无法负担单独的人员来进行此集成。
编写代码的人负责将其合并到测试中,并在另一个集成 webapp 实例(与开发人员机器不同)上完成测试后进行部署
- 目标:防止主要开发人员搞砸
我正在考虑编写一个更新挂钩来检测引用推送
并查看推送提交的消息
https://gist.github.com/23b807f29c37c5699670
是的,这很丑陋,
一些开发人员手动从他们的克隆中推送,有些则不然
,我应该确保每个人都使用需要任务分支的部署脚本名称并显示推送的提交列表,然后将其合并到 master 并推送
任何想法
禁止通过中央存储库中的挂钩将测试合并到 master
禁止通过开发人员机器上的挂钩将测试合并到master中
there are some repositories (one-per-indepndent-module fashion) in gitosis
two branches: master (production receives updates from this branch) and testing
task: for every repository deny attempts to screw up master branch:
prohibit pushing testing into master mergesituation: recently migrated from svn to git
everybody have local clone and a local branch for every bug
he merges it into testing (our integration branch), then, if qa approves, deploys (merges into master and push)
not much manpower, like one most active person per repository
who knows what happening there - he is a git newbie, like I am
We need central integration branch and ready to use production branch as soon as possible, but cannot afford separate man just to do this integration.
Person who wrote the code is responsible for merging it into testing and deploy after testing done on another, integration webapp instance (different from developer mashine)
- goal: protect from this main developer screw ups
I am thinking to write an update hook which detects ref being pushed
and looks through messages of pushed commits
https://gist.github.com/23b807f29c37c5699670
yeah this is ugly
some developers push from their clones manually, some aren't
maybe I should ensure everybody to use deploy script which takes task branch name and show list of pushed commits before merging it into master and pushing it
any ideas
to prohibit merge testing into master via a hook in central repository
to prohibit merge testing into master via a hook at developer mashine
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果每个人都推送到一个中央存储库,那么您将遇到非分布式版本系统的大部分问题。
分布式的方法是:只让那些你信任的人(例如你和 Linus 等)拥有对“规范”存储库的写访问权限。让所有其他用户拥有自己的存储库的公共镜像(只有他们可以推送,每个人都可以从中提取),可信用户可以从中提取,然后推送到规范存储库。问题解决了。
If everyone is pushing to one central repo, you'll get most of the problems of non-distributed version systems.
The distributed way of doing it is: Let only those you trust (e.g. you and Linus etc.) have write access to the "canonical" repository. Let all other users have their own public mirror of their own repo (one that only they can push to, and everyone can pull from) that the trusted user(s) can pull from, then push to the canonical repo. Problem solved.
我只会将其限制在中央存储库上。如果当时需要的话,本地开发可以顺势而为并推动到不同的分支。
您在钩子中缺少的是检查用户。添加它以确保 /someone/ 可以推送到 master。
或者,创建另一个存储库,并通过修改配置只授予您自己和其他人写入权限。这根本不需要您使用钩子。
I would only restrict this on the central repository. Local development can roll with the punches and push to a different branch if they need at the time.
What you are missing in the hook is checking the user. Add that to ensure that /someone/ can push to master.
Alternatively, make another repo and give only yourself and whoever else write access by modifying the config. This would not require you to use hooks at all.