4

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

Gromlof
  • 41
  • 1
  • 1
  • 2
  • 1
    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. – joanis Mar 31 '21 at 19:32
  • 1
    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. – joanis Mar 31 '21 at 19:33
  • 1
    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. – joanis Mar 31 '21 at 19:36
  • 1
    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. – torek Mar 31 '21 at 23:49
  • 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 ! – Gromlof Apr 01 '21 at 09:19

7 Answers7

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

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
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Lionel
  • 11
  • 2
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.

Hashim Aziz
  • 4,074
  • 5
  • 38
  • 68
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.

Abid
  • 96
  • 2
0

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

Neil Gatenby
  • 419
  • 6
  • 21
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
Harsh
  • 812
  • 1
  • 10
  • 23
0
$ git config --local --replace-all core.autocrlf true

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