1

How one can made config options like

[gc] reflogExpire = never

be permanent with the repository, so they get pushed / pulled and cloned (everybody using the repository get em automatically)

schnedan
  • 234
  • 1
  • 9
  • Related but not duplicate: https://unix.stackexchange.com/questions/42785/can-git-configuration-be-set-across-multiple-repositories I suspect it cannot be done directly, as the config never gets pushed or pulled as far as I know. – joanis Feb 15 '22 at 13:49
  • My approach with something like this is to include a script in the repo that the readme says you should run whenever you clone the repo. Then it's trivial for each developer to apply on their machine. But it's flaky: so far, my "please, every one, run this script" efforts have only yielded relatively low compliance rates. They typically get run by any given developer only when they hit the problem that script tried to prevent in the first place... – joanis Feb 15 '22 at 13:53
  • Ah, this one is a duplicate of your question, with a good answer: https://stackoverflow.com/questions/18329621/how-to-store-a-git-config-as-part-of-the-repository – joanis Feb 15 '22 at 13:55
  • @joanis OK that's exactly my solution I am currently trying. But as you stated, I do not a high adoption rate... – schnedan Feb 15 '22 at 15:03
  • 1
    Git intentionally doesn't let you store config in the repository because anyone who can make changes to the repo config can execute arbitrary code. A standardized setup script is your best bet here, but that depends on your users trusting you enough to run it. – bk2204 Feb 15 '22 at 22:41
  • This is why I like git more every day: clever design (code execution possible by config files...), usefull defaults like autoclf and reflog expire + the possibility to change that defaults at least on project level.... jesus help. – schnedan Feb 15 '22 at 23:54

0 Answers0