Git ignores change to core.autocrlf
Asked Answered
M

1

7

I have core.autocrlf set to true. I want to change it to false. In Git Bash I ran

git config --global core.autocrlf false

but git config --list still shows core.autocrlf=true.

I have retried restarting Git Bash and running in an empty directory, i.e. not a repo but nothing seems to change it. Any ideas?

Marianamariand answered 30/9, 2016 at 0:39 Comment(4)
What do you get when you run these 2 commands? git config --get --local core.autocrlf git config --get --global core.autocrlfSing
@TeamTam, I get nothing for the first command (--local) and I get 'false' for the second (--global)! Why does the second differ from git config --list?Marianamariand
Git gets its configs from various sources (i.e. local, global, system). When you call git config --list it will show them all as-is without aggregating them IIRC. So I suspect that you just need to work out which config file your setting is coming from and the precedence of it.Sing
@Sing Did you mean a latter line will overwrite a previous line?Mandarin
S
8

With git version 2.8 onwards, you can simply use:

git config --list --show-origin

You will see which config is set where.

This should allow you to check if the core.autocrlf global setting is being overridden by a repository specific setting and might explain why it appears that the setting seems to be ignored.

Sharma answered 30/9, 2016 at 5:57 Comment(2)
thanks. This is what the --show-origin reveals: file:"C:\\ProgramData/Git/config" core.autocrlf=true file:C://Users/<me>/.gitconfig core.autocrlf=false So, I have two, and 'git config --list' only prints the one in ProgramDataMarianamariand
Can you post the output of git config --list | grep autocrlf and git config --list --show-origin | grep autocrlf in your question please? Also what is the version of Git for Windows that you are using?Sharma

© 2022 - 2024 — McMap. All rights reserved.