How can I make git stop trying to insert CR into local files?

I tried to use many different configurations to try to get git to stop this. I have a local file with LF line ending (not CRLF) in the source repo:

$ cat -vT  Source/watchr.bat
echo OFF
echo ==========================================================
echo ==========================================================
echo The "watchr" command is deprecated.
echo The new command is sidekick.bat
echo " _
echo "| |
echo "| |_ _   _ _ __   ___

Note: no ^ M, so there is no CR. This is one of about 80 files, so committing will create massive unnecessary churn in git history.

Now look at git diff:

$  gd -R  Source/watchr.bat
+echo OFF^M
+echo ==========================================================^M
+echo ==========================================================^M
+echo The "watchr" command is deprecated.^M
+echo The new command is sidekick.bat^M
+echo " _                      ^M
+echo "| |                    ^M
+echo "| |_ _   _ _ __   ___ ^M

Argh, ^ M on each line. What for? How?

Settings:

$ git config --global core.autocrlf
true

$ git config  core.autocrlf
false

$ cat -vT .gitattributes
# Set default behavior to automatically normalize line endings.
* text=

Changing the settings to input(or false) and auto(gitattributes) has no effect, git still wants to insert the CR into the watchr.bat file. Gitconfig in my home directory as well autocrlf = true. How do I get git to stop this?

Platform: git version 1.9.5.msysgit.0, Windows 7.

+4
2

, .gitattributes. * text=auto .gitattributes, , -, "" git. , , , " CRs " .

git, .gitattributes ( , ). git, , , git , diff. , .

, git Windows ( Windows).

+1

:

git config --global core.autocrlf false

( , Git Windows (msysgit) - Unix DOS)

:

git config core.autocrlf false

, .gitattribute core.eol, \r\n eol.

+3

Source: https://habr.com/ru/post/1570804/


All Articles