处理私人和公共存储库的技术? [英] Techniques to handle a private and public repository?

查看:143
本文介绍了处理私人和公共存储库的技术?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个开源的网站。一些内容是私人的,如连接参数,以及开源版本不需要的文件(例如广告模板)。

基本上我是试图维持两个版本:


  • 具有唯一身份的公共站点(广告,Google Analytics帐户,关联论坛链接等) )

  • 一个用于社区开发的开源版本,没有不必要的依赖关系或品牌



使用 .gitignore 文件阻止将私人内容推送到开放源代码存储库。除了包含本地找到的模板的帮助程序外,还显示了开放源代码版本的空白框。



直到我尝试在功能分支:分支可能需要设置文件中的新密钥。由于设置文件被Git忽略(为了避免推送密码等),网站就会中断。



理想情况下,我想要版本控制设置文件,但能够告诉Git不要将这些文件推送到远程服务器(Github)。是否有可能?



我应该使用分支来管理不同的网站版本吗?

解决方案 div>

您应该使用 git submodules


  • 一个模块适用于所有公共内容,可随时推送/拉取

  • 一个用于私人内容的模块

  • 一个超级项目,也用于私人回购,它引用公共和私有子模块。



一个回购中的分支不是答案,尤其是在处理敏感信息时。


I have an open source'd website. Some content is "private" such as connection parameters, as well as files that the open source version doesn't need (eg. advertising templates).

Essentially I'm trying to maintain two versions:

  • A public site that has a unique identity (advertising, Google Analytics account, link for associated forum and so on)
  • An open source version for community development, without unnecessary dependencies or branding

Currently I'm using a .gitignore file to prevent the "private" content to be pushed to the open source repository. Along with a helper that includes templates that are found locally, but shows an empty box for the open source version.

This works well enough until I try to checkout between feature branches: a branch may need a new key in the settings file. Because the settings file is ignored by Git (to avoid push'ing passwords and so on), the site breaks.

Ideally I'd want to version control settings files, but to be able to tell Git not to ever push these files to a remote server (Github). Is that possible?

Should I use branches to manage different website versions instead?

解决方案

You should use git submodules with:

  • one module for all the public content, which can be pushed/pulled at will
  • one module for the private content
  • one super-project, also in a private repo, which references both the public and the private submodules.

Branches within one repo is not the answer, especially when dealing with sensitive informations.

这篇关于处理私人和公共存储库的技术?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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