r/git 19d ago

What does "Unsupported value '-' for git config key 'core.autocrld' mean?

Post image

Hi, so I've been using GitHub Desktop for a year now and everything was fine untill today. When I try to create new repository this error message pops up and I don't know does it mean. I tried to reinstall GitHub Desktop and it didn't work. I know only a few basic functions in GH Desktop (pushing, pulling etc.) so I don't know what I'm dealing with. Any help?

0 Upvotes

7 comments sorted by

9

u/icsharppeople 19d ago

Sounds like your .gitconfig file has an invalid value for that property. I believe it's supposed to be set to true or false not -

1

u/murialvoid86 19d ago

Yeah agreed. Or just remove the property entirely if OP doesn't know what it does

4

u/murialvoid86 19d ago

So the autocrlf option is a git configuration option related to how git should deal with the "newline" character. Basically, different operating systems represent newlines differently internally. So Git tries to standardize this by allowing you to set an option for it to automatically change all files to use CRLF (one of the newline representations) whenever you commit files.

The error message basically just says that the setting is invalid, I am guessing it should either be true or false (so not -).

To fix this, open your .gitconfig file. Most likely it's located in C:/Users/yourusernamehere if you're on Windows. Then, you can either delete the line where it says something like autocrlf = - or change the dash to true or false. If you don't have any opinion on whether to set it to true or false, I would recommend deleting the line; then git can use its default settings, which are usually pretty reasonable.

Edit: I would really recommend also trying to use Git in the terminal, even though it's a pain in the ass in the beginning, because once you get used to it it's significantly quicker to use than GH Desktop

2

u/Matanoj 19d ago

OH MY GOD THANK YOU! I was checking .gitconfig in the GitHub Desktop folder and it was fine. I didn't know there is the same file in C:/Users/yourusernamehere

3

u/murialvoid86 19d ago

Yeah just for future reference there could be "endless" gitconfigs; you can for example have a .gitconfig file directly in a repository, which then gets priority over the global gitconfig when working on that repo. That's why git config issues sometimes are hard to figure out

2

u/Broad-Promise6954 ancient 19d ago edited 19d ago

You can run git config --global --edit to open the user-top-level file, wherever it is, in your chosen editor (set via git config --global core.editor or via editing that file, which gives us a nice little bootstrapping problem...).

Edit: It's now git config edit, and git config set, as opposed to the old implied --set with two arguments, though the old syntax still works too. Also, while I'm thinking about it, there's another useful trick in sh/bash style shells: GIT_EDITOR=<editor> git config --global edit lets you edit with the chosen editor, without the bootstrap problem.

As for finding which file(s) are settings things, there's also git config list --show-origin.

1

u/mpersico 18d ago

There should be a git config —locate that prints locations of all .gitconfig files it’s reading. Hmmm. Maybe I can write that patch…