分离CodeIgniter配置文件Git以公开发布 [英] Separating CodeIgniter config file Git for publishing publically

查看:135
本文介绍了分离CodeIgniter配置文件Git以公开发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将开始一个基于CodeIgniter的项目,并计划将Git用作我们的DVCS。我将与其他一些开发人员合作,并且中央(原始)服务器是私人托管的。但我也想开源并在稍后将代码发布到Github。



我的问题是,有没有办法在Git中分离配置文件,因此配置文件中的私人信息不会发送到Github远程设备,而是发送给其他同行。



另一个问题是我们可以使用类似的解决方案本地开发配置文件和一个用于生产的服务器?

解决方案

创建文件 config.php.sample database.php.sample ,您的每个开发人员都会使用它,并拥有一个用于密码和其他敏感信息的占位符。将 config.php database.php 添加到您的 .gitignore



第一次部署到生产站点时,您将创建 config.php database.php 文件。随后的推送不会覆盖 config.php database.php ,因为它们不包含在git存储库中。

I am about to start a CodeIgniter based project and plan on using Git as our DVCS. I will be working with a few other developers, and the central (origin) server is privately hosted. But I also want to open source it and publish the code to Github later.

My question is, is there a way to separate the config file(s) in Git, so that the private information in the config file is not sent to the Github remote but is to origin and other peers.

Another question is could we use a similar solution for having local development config files and a server one for production?

解决方案

Create the files config.php.sample and database.php.sample that each of your developers will use that has a placeholder for the passwords and other sensitive information. Add config.php and database.php to your .gitignore

The first time you deploy to the production site, you'll create the config.php and database.php files. Subsequent pushes won't overwrite config.php and database.php since they're not included in the git repository.

这篇关于分离CodeIgniter配置文件Git以公开发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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