Reputation: 85
On our system, we used to be able to convert all CRLF to LF while committing file into git. Now this feature is gone.
Here is what I've done:
git config --global core.autocrlf false
After doing the above, I use the following command to check:
git config --list
The result is:
...
core.autocrlf=input
...
core.autocrlf=false
...
It's very puzzling. While there's two entries of core.autocrlf
, and the first one is core.autocrlf=input
? If I unset core.autocrlf
using:
git config --global --unset core.autocrlf
I still get one entry when I list git config:
core.autocrlf=input
Step 2:
After I did git config --global core.autocrlf false
, I add * text=auto
into .gitattributes
file.
But git still does not automatically convert line break for me.
Upvotes: 7
Views: 13256
Reputation: 2110
Since git1.8.1rc1 :
"git config --get" used to diagnose presence of multiple definitions of the same variable in the same configuration file as an error, but it now applies the "last one wins" rule used by the internal configuration logic
So your second setting apply.
For more explaination on option for core.autoctrlf :
If you’re on a Windows machine, set it to true – this converts LF endings into CRLF when you check out code:
$ git config --global core.autocrlf true
You can tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input:
$ git config --global core.autocrlf input
If you’re a Windows programmer doing a Windows-only project, then you can turn off this functionality, recording the carriage returns in the repository by setting the config value to false:
$ git config --global core.autocrlf false
more explanation : http://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#Formatting-and-Whitespace
Upvotes: 13