Cannot get git autocrlf=true to work

Ok, so i have read all threads on this topic, and my understanding is the following:

if i set core.autocrlf = true in Windows, git should convert all my crlf line endings to LF when committing and pushing.

  • 'git apply' failed with code 1: trailing whitespace in SourceTree
  • Git, adding files to repository gives fatal error for LF ->CRLF
  • Why are there two different lines with core.autocrlf output with “git config -l”?
  • Is there a way to determine the line endings in a existing git repo?
  • Can core.autocrlf be pushed to remote repository?
  • Android Studio - CRLF vs LF for a Git-based multiplatform project
  • This is what i want, and i have my config set up as such. However, when i check in a text file with CRLF endings, i get the error messsage:

    fatal: LF would be replaced by CRLF
    

    I don’t get it… shoudn’t the opposite happen when i commit?

  • Setup Git-server on windows computer
  • PhpStorm external tools before commit
  • Stage files, then remote add, then pull - and my files are gone
  • Add FOSUserBundle to project git repository
  • Deploy Azure web app with private credentials via Git
  • Git: Merging two remote branches
  • One Solution collect form web for “Cannot get git autocrlf=true to work”

    The message is misleading, but makes sense:

    1. You check in your file, line ending normalization is done: CRLF is replaced with LF, LF is kept as LF.
    2. Later on, you check out the file in question. Now git will “undo” the line ending normalization: LF will be replaced with CRLF.

    At the end of that process, all the LFs in your working dir have been replaced with CRLF. That is what git is warning you about.

    Note: I would not recommend using core.autocrlf – it is an old setting that has been superseded. Use attributes instead. See here: https://stackoverflow.com/a/13154031/758345

    Git Baby is a git and github fan, let's start git clone.