Line endings in git

I am new to git, i was using svn earlier and we had issues caused by line-endings (CRLF and LF). now i am afraid this ll happen again in git too, the reason for my worry is different developers using different OS. and i am using a windows system with a Linux VM as my development environment. so project code is on linux and i edit it on windows. in the vm i have git which i use to push and pull etc. should i enable autocrlf to true? will it prevent issues for me? but i saw some ware i should set autocrlf = true in windows only.
i hope someone can offer useful advice 🙂

Thanks in advance.

  • Powershell asking for git RSA passphrase on every pull instead of on startup?
  • How to use android's repo tool for Python?
  • What's the use case for “git branch -d”
  • Pulling branch gets unable to connect error
  • Git workflow for constantly diverged master and releases branches
  • Merging upstream git changes with pending pull requests
  • npm package from private github repo, install vs update (package.json)
  • git - Is git show safe to use on binary files when the output is redirected to a file?
  • GIT - how do I copy SHA without mouse on OSX?
  • Git add . ignores .gitignore
  • In Git, removing DLL and PDB files that have accidently been committed
  • How do I rename a Git repository created with gitolite?
  • 2 Solutions collect form web for “Line endings in git”

    Contrary to “Dealing with line endings”, I would recommend to always set core.autocrlf to false (on Windows or any other platform):

    git config --global core.autocrlf false
    

    You don’t want git to automatically changes files on a repository-wide basis without your explicit instruction.

    Once you have identified specific files which requires eol management, list them in a .gitattributes file, with core.eol directives.

    Welcome to Git.

    Here is one doc can help you set up your git conf file to handle this. Read it and practise you will love git.

    Dealing with line endings

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