Can't disable autocrlf using .gitattributes

198 Views Asked by At

I have a directory called "test" in which I've placed some text files with various line endings. The trouble is Git for Windows insists on converting the file with LF line endings to CRLF because autocrlf is enabled.

To try and get around this I've placed a .gitattributes file in the root of the repository with:

test -text

The problem is it has no effect. I've tried deleting the file and doing git checkout on it but it still has CRLF line endings even though the file in the remote repository has LF line endings.

What am I missing?

1

There are 1 best solutions below

0
On

Using test/** instead of test as the pattern matcher in my .gitattributes fixed the issue. According to the documentation:

patterns that match a directory do not recursively match paths inside that directory (so using the trailing-slash path/ syntax is pointless in an attributes file; use path/** instead)