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
| Value | On commit (add) | On checkout | Typical use |
|---|---|---|---|
| true | CRLF → LF | LF → CRLF | Windows, when other tools need CRLF |
| input | CRLF → LF | no conversion | Linux, macOS, WSL |
| false | no conversion | no conversion | when .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:
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.autocrlfOutput
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
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 -2Output
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:
* text=auto
*.sh text eol=lf
*.bat text eol=crlf
*.png binarySources
Related pages
cheat sheets · gitGit cheat sheet: everyday commandsGit cheat sheet: setup, stage and commit, branches with switch, history, undo with restore, reset and revert, stash, remotes, tags and the reflog on one page.glossary · gitWhat is a detached HEAD in Git?Detached HEAD means HEAD points at a commit instead of a branch, after checking out a tag or a hash. New commits there belong to no branch until you create one.compat · gitGit features by version: switch, sparse-checkout, reftableWhich Git version introduced each feature: switch and restore 2.23, sparse-checkout 2.25, SHA-256 2.29, force-if-includes 2.30, zdiff3 2.35, reftable 2.45.