Skip to content

/config/git/core-autocrlf

git config core.autocrlf: true, input or false

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · git version 2.55.0.windows.5updated 2026-10-20
tool
Git
file
.gitconfig / .git/config
key
core.autocrlf
type
true | input | false
default
false (the Git for Windows installer can set a system-wide value; check with git config --show-origin core.autocrlf)

core.autocrlf tells Git whether to convert line endings between the repository and your working tree. true stores LF in the repository and checks files out with CRLF (Windows), input converts CRLF to LF when you commit and never adds CRLF (Linux and macOS), and false leaves bytes untouched.

The three values

ValueOn commit (add)On checkoutTypical use
trueCRLF → LFLF → CRLFWindows, when other tools need CRLF
inputCRLF → LFno conversionLinux, macOS, WSL
falseno conversionno conversionwhen .gitattributes handles it

See the conversion warning

With true, adding an LF file prints a warning that Git will write CRLF the next time it touches the file:

bash
git init -q -b main repo && cd repo
git config core.autocrlf true
printf 'line one\nline two\n' > lf.txt
git add lf.txt
git config --get core.autocrlf

Output

warning: in the working copy of 'lf.txt', LF will be replaced by CRLF the next time Git touches it
true

Commit CRLF, store LF with input

bash
git init -q -b main repo && cd repo
git config core.autocrlf input
printf 'line one\r\nline two\r\n' > crlf.txt
git add crlf.txt 2>/dev/null && git commit -qm "add"
git cat-file -p HEAD:crlf.txt | od -c | head -2

Output

0000000   l   i   n   e       o   n   e  \n   l   i   n   e       t   w
0000020   o  \n

The blob in the repository contains \n only: the \r characters were removed on commit.

Prefer .gitattributes for teams

core.autocrlf is a per-user setting. A committed .gitattributes applies to everyone:

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

Sources