When I try to commit some changed files, I get the following error message with TortoiseGit
fatal: LF would be replaced by CRLF in <some file in the repo>
Now, before I get the usual LF vs CRLF
answers, I know and understand what the debate is about. Secondly, I've also set my global settings to:
core.autocrlf true
Third, I've got a .gitattributes
file.
So I -want- to make sure or files are forced to have CRLF
.
What I don't understand is that it's saying FATAL
and blocking me from continuing. A Warning? Sure! Do I know what I'm trying to do? I do!
I just want it to convert silently and STFU.
Alternatively, if it's forced to BLOCK me, is there a way I can update all files in the repo to be CRLF
, so this warning can get lost?
These repo's are private, so they will never be developed outside of Windows + Visual Studio.
Can anyone please help without denigrating this thread into a autocrlf TRUE
vs autocrlf FALSE
religious war.
You might want to set
core.safecrlf
to "warn", if you want only warning and not a fatal error.From "
git config
" mange page:core.safecrlf
I prefer identifying the exact files or types of file I want to force the eol with
.gitattributes
files only (withcore.eol
settings, which you have), and leaveautocrlf
to false.In case of text fiels with mixed eol, this blog post suggests, for instance, to:
Warning, if you have Git 2.17 or 2.18: a regression introduced in 8462ff4 ("
convert_to_git()
:safe_crlf/checksafe
becomesint conv_flags
", 2018-01-13, Git 2.17.0) back in Git 2.17 cycle causedautocrlf
rewrites to produce a warning message despite settingsafecrlf=false
.See commit 6cb0912 (04 Jun 2018) by Anthony Sottile (
asottile
).(Merged by Junio C Hamano --
gitster
-- in commit 8063ff9, 28 Jun 2018)With .gitattributes file, use
as is documented in https://git-scm.com/docs/gitattributes.
This will disable the crlf fatal warning.
Since your repo is private, you can set
git-config
like this:git config --global core.autocrlf false
This will solve your problem.If you have any further question, You can read the 《Pro git》:
But when collaborating, you should better do these below:
.gitattributes
, Github help-Dealing with line endings will be helpful.git config --global core.safecrlf true
git config --global core.autocrlf true
git config --global core.autocrlf input
You may want to Read Git docs-git config for more info.
git config --global core.autocrlf false
will checkin files with CRLF, that is not used to.I've noticed on Windows, that with
core.autocrlf true
git doesn't like files with LF andcore.autocrlf input
doesn't like CRLF.So: commit CRLF files with
core.autocrlf true
and LF files withcore.autocrlf input
(or convert them to CRLF).Usually files with LF is autogenerated by code generators (e.g. https://start.spring.io or http://yeoman.io/)