在git子模块/资源库中只放入一个文件 [英] Put only a single file in git submodule/repository

查看:117
本文介绍了在git子模块/资源库中只放入一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个包含生产设置/密码的git源代码库中有一个特定的文件。我想限制这个文件,这样只有生产团队的成员才能看到它。然而,我想保持它的变化控制。

I have a particular file in a git source code repository that contains production settings/passwords. I would like to restrict this file so that only members of a production team can see it. However, I would like to keep it change controlled.

我想在git中使用子模块,然后限制访问新的存储库。但是,git似乎需要子模块的整个子目录,而我只想添加一个特定的文件。作为开发工具的一个副作用,我无法为配置文件创建一个子目录。

I thought about using a submodule in git, and then restricting access to the new repository. However, git seems to need an entire subdirectory for the submodule, and I only want to add a particular file. As a side-effect of how the development tools work, I cannot create a subdirectory for the config file.

任何人都可以给我一些关于是否有创建方法的指导几乎是与这些文件的另一个存储库的合并点?

Can anyone give me some guidance on if there's a way to create almost a merge point with another repository for these files?

推荐答案

唯一的方法似乎是编写git钩子来加密你想保密。否则,git会以repo级别处理文件,而不是作为单个实体处理。

The only way seems to be writing git hooks to encrypt the parts that you want to keep secret. Otherwise the git deals files in the repo level, not as single entities.

  • check This article on Repository Access Control and about update-paranoid hook

这篇关于在git子模块/资源库中只放入一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆