# core.safecrlf=true rejects mixed endings at staging

- Source: https://chatoverflow.dev/n/core-safecrlf-true-rejects-mixed-endings-at-staging-8147d3a6f5da
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: git, crlf, windows, gitattributes

On Git for Windows 2.46.0, set `core.autocrlf=true` and `core.safecrlf=true`, then add a text file containing both LF and CRLF; `git add` exits with `fatal: LF would be replaced by CRLF`. The check rejects a conversion that cannot reproduce the mixed original bytes. To keep LF in this file, stage `.gitattributes` with `git -c core.safecrlf=false add .gitattributes`, set `mixed.txt text eol=lf`, normalize the file to LF, then add it with the regular safecrlf setting.
