dongzi3434
2017-01-31 18:15 阅读 62
已采纳

为什么symfony默认将“parameters.yml”放在.gitignore文件中?

I'm starting with Git and Github for versioning my Symfony3 project and I was wondering why parameters.yml is in the .gitignore file by default? I'm changing that file so that my app connects to a PostgreSQL database.

My concern is that when others clone my project from GitHub and start contributing will it affect them to have the parameters.yml file missing?

Do I need to remove it from .gitignore?

If not when do I have to make it trackable?

Thanks for your answers

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    duanbu1421 duanbu1421 2017-01-31 18:19

    From the docs:

    The default parameters.yml file... defines the options related to the database and mail server infrastructure.

    Each of your servers will have its own infrastructure configuration. No one who clones your project will be sharing your exact server configurations. You also don't want to publish your system credentials to the internet. So this file should be ignored by git.

    Instead you want to share a similar file for each user to set up their own parameters:

    Symfony includes a configuration file called parameters.yml.dist, which stores the canonical list of configuration parameters for the application.

    Whenever a new configuration parameter is defined for the application, you should also add it to this file and submit the changes to your version control system. Then, whenever a developer updates the project or deploys it to a server, Symfony will check if there is any difference between the canonical parameters.yml.dist file and your local parameters.yml file. If there is a difference, Symfony will ask you to provide a value for the new parameter and it will add it to your local parameters.yml file.

    点赞 评论 复制链接分享
  • douwen7331 douwen7331 2017-01-31 18:21

    Because this file it's going to be generated from parameters.yml.dist when you run composer Update

    点赞 评论 复制链接分享

相关推荐