Using Git on Windows Commandline
If you are using Git on Windows, chances are you are using TortoiseGit for a convenient GUI and context-menu integration. However, sometimes you may want to use the console. Be it because it’s just faster, or because you want to add or remove a lot of files and don’t want TortoiseGit to block (which it does).
If you have set autocrlf and safecrlf to false in your global git config via TortoiseGit, and I hope you did, and now you use your commandline Git you may wonder why it warns you that it will convert new-lines as if those 2 settings were true.A
git config --global core.autocrlf will tell you: The environment variable HOME is not set. Thus, the .gitconfig file in your user home directory is not found by your console Git.
The solution? If you want to fix it for that instance of your cmd just set the variable via
set HOME=%USERPROFILE%. I do recommend to set it in your persistent user environment variables though, so you won’t have to set it whenever you use a new instance of your commandline (each time you start it) and don’t want to create a specific shortcut for your git command line.
After setting the environment variable, you’ll have to call cmd32.exe again of course, so it will load up your newly set environment variable.
git config --global core.autocrlf will tell you: It is set to false. Nice! As expected, works now.