0

How to add a file to the git, so that other users download it and immediately ignore it?

  • I have existing project.
  • I want to add a file named "config.ini" to it.
  • I want to push this file to repository.
  • I want other users to pull this file.
  • But that changes in it would be ignored.

Is it possible? How?

moyer
  • 1
  • 4
    No. A file is either ignored by git or not. Git does not feature write protection. I think you´re just doing it wrong and should find a better workflow like using ENV vars. – max Mar 07 '18 at 17:15
  • 1
    I don’t think there’s a way to do this. You can commit `config.example.ini` and have people cloning (or some automated process) copy it to `config.ini`, though. – Ry- Mar 07 '18 at 17:19
  • Check [this answer](https://stackoverflow.com/a/44237157/4265352) on a similar question. – axiac Mar 07 '18 at 17:35
  • Possible duplicate of [git hooks : is there a clone hook?](https://stackoverflow.com/questions/10228065/git-hooks-is-there-a-clone-hook) – Philip Pittle Mar 07 '18 at 19:31
  • You can use a git hook on clone. See: https://stackoverflow.com/questions/10228065/git-hooks-is-there-a-clone-hook – Philip Pittle Mar 07 '18 at 19:31
  • Possible duplicate of [Is it safe to keep sensitive data in branches that are not pushed?](https://stackoverflow.com/questions/44236984/is-it-safe-to-keep-sensitive-data-in-branches-that-are-not-pushed) – phd Mar 07 '18 at 22:29

0 Answers0