忽略rails项目中的.gitignore config / database.yml [英] Ignoring .gitignore config/database.yml in a rails project

查看:651
本文介绍了忽略rails项目中的.gitignore config / database.yml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当工作在rails项目(我仍然在初学者阶段的学习在这一刻顺便)文件config / database.yml似乎是一个像数据库密码等东西去。但是,没有人似乎建议将其放在.gitignore文件中 - 为什么?

When working on rails project (I'm still in the "beginner" phase of learning at the moment by the way) the file config/database.yml seems to be the one where things like database passwords etc. go. However, nobody seems to recommend putting it in the .gitignore file - why?

当然,我需要排除这个,或者我的敏感数据库配置细节将被公开的知识,如果我推送到github。

Surely I would need to exclude this or my sensitive database configuration details would end up being public knowledge if I pushed to github.

推荐答案

database.yml 是配置数据库凭据的适当位置。通常,您只需配置您的开发和测试环境,即可提交 database.yml

database.yml is the proper place for configuring your database credentials. Normally you'd commit database.yml while only configured with your development and testing environments.

我没有在我的本地Postgres和MySQL实例上有密码,所以我可以安全地提交 database.yml 。如果你想忽略它,只需添加 database.yml 行到你的 .gitignore 文件的结尾。你需要确保它被清理和提交之前忽略它。

I don't have passwords on my local Postgres and MySQL instances so I can safely commit database.yml. If you want to ignore it, just add database.yml line to the end of your .gitignore file. You'll need to make sure it's cleaned up and committed before ignoring it. Then you can make your changes safely.

一旦部署到生产环境,您就可以使用敏感凭证从已经存储在该服务器上的副本中进行符号链接。

Once you deploy to production you would symlink it in from a copy already stored on that server with the sensitive credentials.

这篇关于忽略rails项目中的.gitignore config / database.yml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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