Running git on a Windows XP machine, using bash. I exported my project from SVN, and then cloned a bare repository.
I then pasted the export into the bare repositori
I think @Basiloungas's answer is close but out of date (at least on Mac).
Open the ~/.gitconfig file and set safecrlf
to false
[core]
autocrlf = input
safecrlf = false
That *will make it ignore the end of line char apparently (worked for me, anyway).
OP's question is windows related and I could not use others without going to the directory or even running file in Notepad++ as administrator did not work.. So had to go this route:
C:\Program Files (x86)\Git\etc>git config --global core.autocrlf false
In vim open the file (e.g.: :e YOURFILE
ENTER), then
:set noendofline binary
:wq
Many text-editors allow you to change to LF
, see Atom instructions below. Simple and explicit.
Click CRLF
on bottom right:
Select LF
in dropdown on top:
Git has three modes of how it treats line endings:
$ git config core.autocrlf
# that command will print "true" or "false" or "input"
You can set the mode to use by adding an additional parameter of true
or false
to the above command line.
If core.autocrlf
is set to true, that means that any time you add a file to the git repo that git thinks is a text file, it will turn all CRLF line endings to just LF before it stores it in the commit. Whenever you git checkout
something, all text files automatically will have their LF line endings converted to CRLF endings. This allows development of a project across platforms that use different line-ending styles without commits being very noisy because each editor changes the line ending style as the line ending style is always consistently LF.
The side-effect of this convenient conversion, and this is what the warning you're seeing is about, is that if a text file you authored originally had LF endings instead of CRLF, it will be stored with LF as usual, but when checked out later it will have CRLF endings. For normal text files this is usually just fine. The warning is a "for your information" in this case, but in case git incorrectly assesses a binary file to be a text file, it is an important warning because git would then be corrupting your binary file.
If core.autocrlf
is set to false, no line-ending conversion is ever performed, so text files are checked in as-is. This usually works ok, as long as all your developers are either on Linux or all on Windows. But in my experience I still tend to get text files with mixed line endings that end up causing problems.
My personal preference is to leave the setting turned ON, as a Windows developer.
See http://kernel.org/pub/software/scm/git/docs/git-config.html for updated info that includes the "input" value.
In a GNU/Linux shell prompt, dos2unix & unix2dos commands allow you to easely convert/format your files coming from MS Windows