简体   繁体   English

有什么方法可以锁定/解锁中央git仓库吗?

[英]Is there are way to lock/unlock central git repository?

I have two jobs which should be executed at one time. 我有两项工作应同时执行。 Both of them updating and pushing changes to central git repo. 他们俩都更新并推送对中央git repo的更改。 Is there way to lock central repo, so first job will lock it, perform update and realize at the same time second job will wait until repo would be unlocked. 有什么方法可以锁定中央存储库,所以第一个作业将锁定它,执行更新,并意识到第二个作业将同时等待,直到存储库被解锁。

This is probably a bad idea, but you can have these jobs set up a push hook on the remote, that rejects all pushes but those coming from that job. 这可能是个坏主意,但是您可以让这些作业在遥控器上设置一个推钩,该钩将拒绝所有推入操作,但这些操作除外。

When the job's finished, deregister the hook and you should be good to go. 作业完成后,请取消挂勾的注册,您应该一切顺利。 Beware that this is bound to lead to problems, when you don't properly handle errors in your jobs. 当您不能正确处理作业中的错误时,请注意这一定会导致问题。

To set up such a hook, check the git-recieve-pack documentation 要设置这样的钩子,请查看git-recieve-pack文档

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

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