[英]Best way to preserve config file between git pulls
It is really anoying to recreate a config file after every git pull
. 在每次
git pull
之后重新创建配置文件确实很麻烦。 Is there a good method to keep a file from being overwritten, or better yet, only if the remote config file has changed? 有没有一种好的方法可以防止文件被覆盖,或者更好的方法是仅在远程配置文件已更改的情况下?
I always try to store config files out of the repo. 我总是尝试将配置文件存储在仓库之外。 So I usually have a
config.xml.example
or _config.xml
(some filename that isn't actually used) and include the real config.xml
in your .gitignore
file. 因此,我通常有一个
config.xml.example
或_config.xml
(实际上未使用的某些文件名),并将真正的config.xml
包含在您的.gitignore
文件中。 Once you clone the repository, copy and paste the file and update the configuration settings. 克隆存储库后,复制并粘贴文件并更新配置设置。 You can also store production config files in a special directory on your server, and always copy this file over when deploying a build (that way you always know your configuration file will be the right data).
您还可以将生产配置文件存储在服务器上的特殊目录中,并在部署构建时始终复制该文件(这样,您便始终知道配置文件将是正确的数据)。 This also lets you store passwords outside of a repository for security.
这也使您可以将密码存储在存储库之外,以确保安全。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.