Interview Prep/Git & GitHub/Config, Line Endings, Files and Platform Quirks

`warning: in the working copy of 'app.sh', LF will be replaced by CRLF the next time Git touches it`

BeginnerTroubleshootingConfig, Line Endings, Files and Platform Quirks
Answer

Likely causes → You are on Windows with core.autocrlf=true (the Git for Windows default), and the file has LF endings. Git warns it will convert it to CRLF on checkout. Harmless for most source files, harmful for shell scripts and files consumed on Linux.

Diagnose →

git config --show-origin core.autocrlf
git ls-files --eol app.sh        # i/lf w/lf attr/...

Fix → Make line endings explicit per file type in the repo, so every OS behaves the same:

* text=auto
*.sh text eol=lf
*.bat text eol=crlf
*.png binary

Then git add --renormalize . && git commit -m "Normalize line endings".

Prevent → Commit .gitattributes early; do not rely on each developer's core.autocrlf.

All Git & GitHub questions Roadmap: Git & GitHub

More on Config, Line Endings, Files and Platform Quirks