Set local git repo config values on init #3683
Unanswered
old-pigeon
asked this question in
Q&A
Replies: 2 comments
-
For files that require Windows line endings, you can make them templates and use chezmoi's
Use a global git configuration file for this, i.e. create a file called
and then manage this file with chezmoi. |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can use * text=auto eol=lf
*.bat text eol=crlf
*.bat.tmpl text eol=crlf
desktop.ini text eol=crlf For example, this makes all files to use LF, except |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I want to set config values specific to the chezmoi dotfile repo on init. I have two use cases. I have issues with both. Can you help?
Thank you!
Windows CRLF checkout
On Windows, I want to checkout at least some files with enforced CRLF line endings for files which are sensitive to it. The following would need to run before chezmoi checks out the repo for the first time. So I thought about a
init
pre hook, but I think this is a problem because how would chezmoi even know that it should use that hook pre-init if the repo wasn't cloned in the first place? Feels like a chicken-egg-problem. What is the best approach to fix this? It would be too late to do it after initial checkout because the files are already wrongly written with only LN.General user settings
I want to set the user settings for commit name and email for the repo once on any machine. I tried this to debug:
The problem is that it is not executed inside the cloned chezmoi dotfile repo, it instead spits out this error:
I tried inspecting all exported variables but none of them seem to point to the dir of the git repo reliable, so I can't use that either to pass it manually to the git command.
Beta Was this translation helpful? Give feedback.
All reactions