'fatal: bad boolean config value for 'core.autocrlf'
i am new to git and i am doing a test repository to see how it goes.
First when i did git add
i had a warning telling me that my file will be turned to clrf or something like that.
So i tried to change it just to see what it does.
I did something like git config core.autocrlf = false
What i did not expected is that the "=" would be passed as a value to this boolean.
It make's very little sens to me.
So i don't need = to assign a value to a variable fine. I did it again this time git config core.autocrlf false
Then i did git add
and get the following message :fatal: bad boolean config value "=" for 'core.autoclrf
Then i did the git config --get-all core.autocrlf
command to understand. And i'v seen that the value is not override when i set a new value, insted it's add a line with an other value.
I'v checked in my "/Git/etc/gitconfig" file to see what value was set to the autocrlf variable to see if i could change it directly from here but the value was "true".
So i don't understand where the values are stored.
Also i tried
git config --unset-all core.autocrlf
git config --replace-all core.autocrlf
git config --system --unset core.autocrlf
None of that worked. For the last one it was funny, i had a permission denied then did chmod u+x gitconfig
but get a changing permission of gitconfig: permission denied.
So if you know how am i suppose to change the value of this boolean "core.autocrlf" so i can add my repository let me know.##
Solution 1:[1]
Since you see a "bad boolean value", that means you are using Git 2.31+
Only that recent version has improved the error message, as I reported here.
It also means you have the --show-scope
option (introduced with Git 2.26, Q1 2020)
git config --get-all --show-origin --show-scope core.autocrlf
system file:D:/newenv/prgs/gits/current/etc/gitconfig true
global file:C:/Users/vonc/.gitconfig false
^^^^^^
(scope)
(shows you which git config --local/global/system to use)
I would not recommend using --edit
and fiddling directly with a .gitconfig
content. Using unset, then setting it again is safer.
Solution 2:[2]
I had the same issue, if you're on windows simple set it to true:
$ git config --global core.autocrlf true
If you're on macOS set it to false:
$ git config --global core.autocrlf false
Solution 3:[3]
Like OP I also managed to accidentally add a value into the core.autocrlf
boolean - why this is even possible rather than just allowing set
and unset
for boolean config values, I'm not sure.
To fix the fatal error - which prevents git
from being able to do anything at all, including reverting to an earlier snapshot - I did:
git config --edit
...and then simply removed the line containing autocrlf
from my repo's .git/config
file.
Solution 4:[4]
Type this on your terminal
git config --global -e
it will open .gitconfig
If you using windows, go to the folder
C:\Users\xxx_
You will find the .gitconfig
file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | VonC |
Solution 2 | Chris |
Solution 3 | Hashim Aziz |
Solution 4 | Abid |