March 03, 2025

Photo Credit: Dall-E by OpenAI
What’s This Warning?
Git warns:
warning: in the working copy of 'gatsby-config.js', LF will be replaced by CRLFThis happens because Linux/macOS use LF, while Windows uses CRLF for line endings.
What Does This Mean?
This warning appears when your repository has files with LF (Line Feed) line endings, but your local system (likely Windows) is set to use CRLF (Carriage Return + Line Feed). Git is informing you that when it updates the file, it will convert the line endings accordingly.
Why Does This Happen?
Different operating systems use different conventions for line endings:
- Linux/macOS: LF (
\n) - Windows: CRLF (
\r\n)
How to Fix It
-
Keep LF (recommended for cross-platform projects):
git config --global core.autocrlf input -
Use Windows-style CRLF:
git config --global core.autocrlf true -
Enforce LF in a repo:
echo "* text=auto" > .gitattributes
Peace... 🍀