fatal: bad boolean config value for 'core.autocrlf'
Asked Answered
git
S

8

5

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.##

Sibyl answered 31/3, 2021 at 16:1 Comment(5)
Try git config --get-all --show-origin core.autocrlf, it will show you where the config values are found. My guess is that the two instances are not in the same config file.Concision
Also, if you want the setting to be global to your account, use git config --global core.autocrlf false will change your global Git config, while the default is to change only the sandbox you're in.Concision
One more thing, you can manually edit the Git config file with a regular text editor. The easiest way out for you might be to just delete the bad config line and start again.Concision
Also, git config --edit or git config --global --edit will fire up your configured editor (which you should first set with git config of course) on the local or global configuration file.Petuntse
Thank you joanis i did git config --get-all --show-origin core.autocrlf and then with some cd and a start .gitconfig was able to open the file where the wrong value for autoclrf where stored. Also the global command is the thing i was missing here thanks a lot. Thanks Torek this will be very helpfull for editing my settings !Sibyl
M
5

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.

Mortgage answered 4/4, 2021 at 14:19 Comment(0)
B
4

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
Berey answered 12/10, 2021 at 23:18 Comment(1)
...please take a few seconds to proof-read your answer. You managed to typo both "true" and "false"...Tierell
Q
1

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.

Quarter answered 12/4, 2022 at 2:18 Comment(0)
C
1

I was lured here by "fatal: bad boolean config value". I share my experience in case it helps others.

My problem was I'd erroneously typed git config --system core.longpaths true~ (see the last character?). When I tried to fix it with git config --system core.longpaths true all I got was fatal: bad boolean config value 'true~' for 'core.longpaths'

joannis' comment was my saviour; git config --get-all --show-origin core.longpaths tells me which file I had to edit to fix my bad boolean

Circumscribe answered 21/2, 2023 at 12:8 Comment(0)
S
1
$ git config --local --replace-all core.autocrlf true

I used this command to get rid of the error: bad boolean value '=' core.autoclrf.

Seltzer answered 11/8, 2023 at 10:58 Comment(0)
C
0

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.

Chaddy answered 9/5, 2022 at 1:22 Comment(0)
B
0

I just ran into the same problem, when i was searching for warning of clfr to lf conversion warnings.

Solution:

$ git config --global core.autocrlf true
Benford answered 7/4, 2023 at 19:18 Comment(0)
F
0

On windows, go to your C:\Users\[WHATEVER] and edit the gitconfig file found there. You will probably see like three or four lines with completely stupid values, fruit of your attempts to fix the issue, and feel a bit of anger. That is normal, proceed to delete them, leaving only one set to your preferred value. Try using git again - if done correctly, the anger should subside.

I left it on input because I mainly work on a linux machine and I want the files to just be LF.

Footrest answered 9/8 at 17:49 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Paralyse

© 2022 - 2024 — McMap. All rights reserved.