Git ignore line endings

I know that similar questions have been asked, but I still can't get it to work.

My project is shared between people using different operating systems, and I'm on OSX. In addition, not everyone uses git, but sometimes I have to make changes to others.

Sometimes out of nowhere git says there are pending changes. Looking at the files, they look the same:

@@ -1,6 +1,6 @@ -<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" -> - <Deployment.Parts> - </Deployment.Parts> -</Deployment> +<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" +> + <Deployment.Parts> + </Deployment.Parts> +</Deployment> 

I suspect this is a line ending problem.

[edit] One external demarcation tool specifically says: "status: 1 difference. Line endings differ - left: Windows (CRLF), right: Unix (LF)"

Following some online tips, my configuration looks like this:

 [core] excludesfile = /Users/nathanh/.gitignore_global autocrlf = input attributesfile = /Users/nathanh/.config/git/attributes whitespace = cr-at-eol 

And my attribute file:

 # Ignore all differences in line endings * -crlf 

Why does this still show me that the files are modified?

+5
source share
1 answer

Read it on JetBrains.com

In order for Git to solve such problems automatically, you need to set the core.autocrlf attribute to true on Windows and enter it on Linux and OS X. For more information about the value of the core.autocrlf attribute, see article. Remember the end of your line or the deletion with line endings . You can change the configuration manually by running

 git config --global core.autocrlf true 

on windows or

 git config --global core.autocrlf input 

on Linux and OS X. However, IntelliJ IDEA can analyze your configuration, warn you if you intend to pass CRLF to the repository and suggest setting core.autocrlf to true or input, depending on your operating system.

Hope this can shed some light on the problem.

+2
source

All Articles