Git:访问控制?实际操作中如何做

发布于 2024-12-09 02:50:54 字数 656 浏览 0 评论 0原文

如何保护完整(java)应用程序的 GIT 存储库,防止开发人员访问存储库中的所有源代码。我知道 GIT 是一种分布式版本控制,开发人员通常“下载/获取”完整的(!)存储库。

我的问题:

  1. 如何在 git 中分离“模块/自治部分”?例如,拥有一个模块“支付层”、“数据库层”和“处理层”等等,所有这些都通过 API/接口进行抽象。我是否必须为所有这些模块设置单独的 git 存储库?

  2. 有没有一种方法可以在 GIT 中拥有一个大型存储库,但以某种方式限制通过路径的访问? (客户端应该只接收他被授予访问权限的那些文件)

  3. 是否有一种方法可以在 GIT 中拥有一个大型存储库,但以某种方式限制分支/标签的访问? (客户端应该只接收他被授予访问权限的那些文件)

  4. 以防万一有人也知道这一点:Is there a way in eclipse to chekout content from multiple GIT repositories into one project and also (in other way round) commit一个 Eclipse 项目中的代码到多个不同的 GIT 存储库(基于包名称/路径或在上下文菜单中)? 以防万一

非常感谢 马库斯!

how would one protect a GIT repository of a complete (java) application from having a developer getting access to all the source code in the repository. I know GIT is a distributed Versioning Control where a developer normally "downloads/fetches" the complete(!) repository.

My Questions:

  1. How to sperate "modules/autonomous parts" in git? For example havng a module "payment layer" and "database layer" and "processing layer" and so forth all abstracted via APIs/Interfaces. Do i have to setup a seperate git repository for all those modules?

  2. Is there a way to have one large repository in GIT but to somehow restrict the access by path? (A client should only recive those files he was granted access to)

  3. Is there a way to have one large repository in GIT but to somehow restrict the access by Branch/Tags? (A client should only recive those files he was granted access to)

  4. Just in Case someone knows this too: Is there a way in eclipse to chekout content from multiple GIT repositories into one project and also (the other way round) commit code within in one eclipse project to multiple different GIT repositories (based on package names/paths or in the context menu)?

Thank you very much
Markus!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

愛放△進行李 2024-12-16 02:50:54
  1. 如果你想要差异化控制,你必须将代码分割到多个 git 存储库中。你不能通过分支或其他什么来控制。 Git 下载整个存储库。句号。

  2. 您可以研究 git 模块以获取一种机制,以便更轻松地使用由多个 git 存储库构建的事物。

  1. You will have to split up the code into multiple git repositories if you want differential control. You cannot control by branches or whatever. Git downloads the entire repo. Period.

  2. You can look into git modules for a mechanism for making it easier to work with a thing built of multiple git repositories.

荒岛晴空 2024-12-16 02:50:54

1) 和 4) 很大程度上取决于您的构建环境。在 git 中,您尝试为每个模块建立单独的存储库,但如果源代码树的设置变得很痛苦,您可以使用 git 子模块(尽管没有多少人喜欢它们)或 Android 项目使用的 repo 工具。这允许您拥有一个由更多子项目组成的“伞”项目。不确定仅仅为了几个组件是否值得。只有一个 git repo 可能仍然更有意义。

对于问题 2) 和 3):

为了访问,我建议每个子团队保留自己的分支(存储库),并由某人审查他们推送到集成存储库的内容。如果您不喜欢这种方法,您可以使用 git 服务器挂钩来强制编写脚本的策略。

在这种情况下,挂钩可以检查谁在推送,以及针对描述策略的某些配置文件的路径或引用规范(分支)。此处记录:

https:/ /git-scm.com/book/en/v2/Customizing-Git-An-Example-Git-Enforced-Policy

1) and 4) depends a lot of your build evironment. In git you try to have separate repositories per modules, but if the setup of the source tree becomes painful you can use git submodules (though not much people like them) or the repo tool the Android project uses. This allows you to have an "umbrella" project composed of more subprojects. Not sure if it is worth it for just a few components. Just one git repo may still make more sense.

For questions 2) and 3):

For access, I would recommend that every sub-team keeps its own fork (repository) and somebody reviews what they push to the integration repository. If you don like this approach, you can use git server hooks to enforce policies writing scripts.

In this case, the hook could check who is pushing, and the path or refspec (branch) against some config file describing the policy. This is documented here:

https://git-scm.com/book/en/v2/Customizing-Git-An-Example-Git-Enforced-Policy

森罗 2024-12-16 02:50:54

1).查看 Git 子模块 http://linux.die.net/man/1/git-submodule

2,3)。看看 Gitolite https://github.com/sitaramc/gitolite/ blob/pu/doc/gitolite.conf.mkd

4).我认为任何 eclipse-git 插件都不允许这样做。但是,您可以使用外部/命令行客户端来实现您想要的。

1). Look at Git submodules http://linux.die.net/man/1/git-submodule

2,3). Look at Gitolite https://github.com/sitaramc/gitolite/blob/pu/doc/gitolite.conf.mkd

4). I don't think any eclipse-git plugins allows that. However, you can use an external/command-line client to achieve what you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文