How to keep different content of one file in my local and github repository?

后端 未结 2 413
孤独总比滥情好
孤独总比滥情好 2020-11-29 14:02

I have a database.php. I want to keep it in my github repository without any sensitive information.

First I pushed to my repository without any sensitive info.

相关标签:
2条回答
  • 2020-11-29 14:16

    You should use a filter driver able to:

    filter driver

    • on checkout, in the smudge script, detect the content (those 'filter driver' scripts don't have the name of the files they are filtering) of a database.template
    • generate the private, always ignored, database.php, based on the values of a:
      • database.private.value file (also always ignored)
      • or, if database.private.value isn't found (which is the case for your user cloning your repo), a database.public.value file (which is pushed to the remote repo)
    • no need to do anything on the commit (script clean) step.
    0 讨论(0)
  • 2020-11-29 14:37

    You should make 2 different files one actual database.php and one database.php.example or something like that and then add database.php to .gitignore

    0 讨论(0)
提交回复
热议问题