Git line endings need a better option

In my repository, I have several shell scripts that run in the cygwin console on Windows machines. my problem is that every time I update these files, git automatically converts them to the end of the CRLF line, and I have to manually open them, convert to unix, save em, commit them, repeat them when updating.

now if i do

git config --global core.autocrlf false 

then git will stop trying to accept what I want by converting line endings and blindly copy them, fix it?

there is a way that I can configure this configuration parameter to all users of my repository or each user must set this variable himself

+4
source share
1 answer

Parameters set with git -config for one repository are stored inside .git / config, which does not fit other users.

But you can get the same result with gitattributes. Attributes can be set in a file named .gitattributes inside the working line, so it will be redirected to another. In addition, they can be installed for individual files or templates. Placed

*.sh -text

in the .gitattributes file. This will automatically stop all files ending in .sh .

Alternatively you can write

*.sh eol=lf

to force convert to unix format.

+8
source

All Articles