In cases similar to yours where I need to publish parts publicly and keep import data hidden, I usually very simply keep a branch only for production.
In your case, you could either make the dev branch where you publishing everything open source, clone it and receive some contributions from other people. Then have a production branch somewhere different. (heroku..)
You normally don't put those files under version control. Inside a company, say, you can put a template under version control and ask your developers to copy it into place and update as necessary. Like a config.ini.template file with
[smtp]
host = smtp.company.com
user = USERNAME # update this
pass = PASSWORD # and this
where it's clear that the developers need to update the credentials when they rename it to config.ini. The config.ini file should then be excluded from version control.
For an open source project I would probably not put any template under version control. I would still configure it so that the config.ini file is excluded from version control so that I can have my own config.ini file in my working copy without committing it by accident.
I find the above system much easier than putting the real config files under version control. Even if I can put it in a private branch of some sort, then it will require me to constantly merge with that branch and I'll have to be careful not to accidentally push the config file to another repository.
发布评论
评论(2)
在与您类似的情况下,我需要公开发布零件并隐藏导入数据,我通常只是简单地保留一个仅用于生产的分支。
在您的情况下,您可以将发布所有内容的开发分支设为开源,克隆它并接收其他人的一些贡献。然后在不同的地方建立一个生产分支。 (赫罗库..)
In cases similar to yours where I need to publish parts publicly and keep import data hidden, I usually very simply keep a branch only for production.
In your case, you could either make the dev branch where you publishing everything open source, clone it and receive some contributions from other people. Then have a production branch somewhere different. (heroku..)
您通常不会将这些文件置于版本控制之下。例如,在公司内部,您可以将模板置于版本控制之下,并要求开发人员将其复制到位并根据需要进行更新。就像
config.ini.template
文件一样,很明显,开发人员在将其重命名为
config.ini
时需要更新凭据。然后,config.ini
文件应从版本控制中排除。对于开源项目,我可能不会将任何模板置于版本控制之下。我仍然会配置它,以便将
config.ini
文件排除在版本控制之外,这样我就可以在工作副本中拥有自己的config.ini
文件,而无需通过以下方式提交它:事故。我发现上述系统比将真实配置文件置于版本控制之下容易得多。即使我可以将它放在某种私有分支中,那么它也需要我不断地与该分支合并,并且我必须小心,不要意外地将配置文件推送到另一个存储库。
You normally don't put those files under version control. Inside a company, say, you can put a template under version control and ask your developers to copy it into place and update as necessary. Like a
config.ini.template
file withwhere it's clear that the developers need to update the credentials when they rename it to
config.ini
. Theconfig.ini
file should then be excluded from version control.For an open source project I would probably not put any template under version control. I would still configure it so that the
config.ini
file is excluded from version control so that I can have my ownconfig.ini
file in my working copy without committing it by accident.I find the above system much easier than putting the real config files under version control. Even if I can put it in a private branch of some sort, then it will require me to constantly merge with that branch and I'll have to be careful not to accidentally push the config file to another repository.