[英]Create private branch on remote repository in git
I would like to build specific flow on our company git. 我想在我们公司的git上构建特定的流程。
In the other words - is it possible to configure private remote branch in public repository? 换句话说 - 是否可以在公共存储库中配置私有远程分支?
The flow that is used in my team is to have complete separate repositories for each team member in addition to origin on the main git server. 我团队中使用的流程是除了主git服务器上的源之外,还为每个团队成员提供完整的单独存储库。
git push jdoe-private my-cool-branch
git push jdoe-private my-cool-branch
git push origin my-cool-branch
git push origin my-cool-branch
The rationale for this setup for us is to allow devs to freely rebase and avoid the problems that can arise from upstream rebasing and also to have full backups. 对我们来说,这种设置的基本原理是允许开发人员自由地改变并避免上游变基引起的问题以及完全备份。 The separate repositories are only private by convention but would be easy to add access control if required.
单独的存储库仅按惯例私有,但如果需要,可以很容易地添加访问控制。 There is a lot of duplication of data but unless your repo is really huge, this is probably not a concern.
有很多重复的数据,但除非你的回购真的很大,这可能不是一个问题。
The common solution I know is to agree on "branch namespaces", by prepending some string to branch names. 我所知道的常见解决方案是通过将一些字符串添加到分支名称来同意“分支命名空间”。 For example, branches that start with "private/" are for private experiments.
例如,以“private /”开头的分支用于私人实验。 You'd then get branches like
然后你会得到分支
That keeps the branches separate, and makes it clear what their purpose is. 这使分支保持分离,并清楚地表明它们的目的是什么。 However, that way the branches are still public, because anyone can see and pull them.
但是,分支仍然是公开的,因为任何人都可以看到并拉动它们。
If you want to restrict access to these branches based on user, you'd need to have some kind of branch-based access control. 如果要根据用户限制对这些分支的访问,则需要使用某种基于分支的访问控制。 There is no such thing in core git, but some git hosting servers allow this (Atlassian Stash for example).
在核心git中没有这样的东西,但是一些git托管服务器允许这个(例如Atlassian Stash)。 I don't know of any server that allows these kind of private branches, but maybe there is one that allows it or lets you script a solution.
我不知道任何允许这种私有分支的服务器,但也许有一个允许它或让你编写解决方案的脚本。
Note, however, that what you are asking for is rather unusual. 但请注意,您要求的是相当不寻常的。 The common solution is the one I outlined above.
常见的解决方案是我上面概述的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.