LF will be replaced by CRLF
Git’s “LF will be replaced by CRLF” warning means Git detected a line-ending mismatch between your working tree and your Git config — it’s about to convert them.
What It Means
Different operating systems use different characters to mark the end of a line: Unix-like systems (Linux, macOS) use LF (\n), while Windows uses CRLF (\r\n). When you work on a cross-platform team, this mismatch causes problems — files show as changed when nothing actually changed, or scripts break because Windows tools expect CRLF. Git’s core.autocrlf setting attempts to normalize line endings automatically, and this warning tells you it’s about to do so.
Why It Happens
- You’re on Windows with
core.autocrlfset totrue, and a file has LF endings. - You’re on Linux/macOS with
core.autocrlfset toinput, and a file has CRLF endings. - A file was committed with mixed line endings.
- You cloned a repo where some files have LF endings but your Git config expects CRLF.
- A teammate on a different OS committed files without normalizing line endings.
How to Fix It
Step 1: Check your current autocrlf setting
git config core.autocrlfCommon values:
true— Windows: convert LF to CRLF on checkout, CRLF to LF on commit.input— Linux/macOS: don’t convert on checkout, convert CRLF to LF on commit.false— no conversion at all (requires discipline on cross-platform teams).
Step 2: Set the right value for your OS
On Windows:
git config --global core.autocrlf trueOn macOS/Linux:
git config --global core.autocrlf inputStep 3: Use a .gitattributes file (recommended for teams)
Create .gitattributes in the repository root to standardize line endings for everyone:
# Auto-detect text files and normalize to LF
* text=auto
# Explicitly declare binary files
*.png binary
*.jpg binary
*.ico binary
# Explicitly declare files that should keep CRLF
*.bat text eol=crlf
*.cmd text eol=crlfCommit and push the .gitattributes file so every team member uses the same rules.
Step 4: Normalize existing files
After setting up .gitattributes, re-normalize the repository:
git add --renormalize .
git commit -m "Normalize line endings with .gitattributes"Step 5: Disable the warning (if you don’t care)
git config --global core.safecrlf falseThis suppresses the warning but doesn’t fix the root cause — not recommended for shared projects.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro