Closed hwhsu1231 closed 1 year ago
It's line ending of the file and that depends on the git config.
Please search the internet before asking questions.
Oops! I forgot I did change the core.autocrlf
config of C:\Program Files\Git\cmd\git.exe
before. And the cause of this issue is indeed due to the core.autocrlf
values are different:
true
false
C:\Test\msys2.github.io>git config core.autocrlf
true
C:\Test\msys2.github.io>
hwhsu1231@vb-windows MINGW64 /c/Test/msys2.github.io
$ git config core.autocrlf
hwhsu1231@vb-windows MINGW64 /c/Test/msys2.github.io
$
Therefore, after changing the core.autocrlf
value of Git in MSYS shell to true
as well, the problem is sovled.
hwhsu1231@vb-windows MINGW64 /c/Test/msys2.github.io
$ git config core.autocrlf
hwhsu1231@vb-windows MINGW64 /c/Test/msys2.github.io
$ git config --global core.autocrlf true
hwhsu1231@vb-windows MINGW64 /c/Test/msys2.github.io
$ git config core.autocrlf
true
hwhsu1231@vb-windows MINGW64 /c/Test/msys2.github.io
$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
hwhsu1231@vb-windows MINGW64 /c/Test/msys2.github.io
$
Problem Description
I used "Command Prompt" shell to
git clone
the repository, and then usegit status
to check its status, which showed that it is "clean".Click to expand
```cmd C:\Test>git clone https://github.com/msys2/msys2.github.io.git --branch main Cloning into 'msys2.github.io'... remote: Enumerating objects: 13872, done. remote: Counting objects: 100% (2065/2065), done. remote: Compressing objects: 100% (375/375), done. remote: Total 13872 (delta 1112), reused 1948 (delta 1063), pack-reused 11807 Receiving objects: 100% (13872/13872), 28.62 MiB | 3.50 MiB/s, done. Resolving deltas: 100% (7169/7169), done. C:\Test>cd msys2.github.io C:\Test\msys2.github.io>git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean C:\Test\msys2.github.io>where git && git --version C:\Program Files\Git\cmd\git.exe git version 2.41.0.windows.3 ```However, when I opened "MSYS2" shell, checked out to the cloned repository, and then run
git status
, it showed lots of modification, which means it is "dirty".Click to expand
```bash hwhsu1231@vb-windows MINGW64 ~ $ export LC_ALL=en_US.UTF8 hwhsu1231@vb-windows MINGW64 ~ $ cd /c/Test/msys2.github.io hwhsu1231@vb-windows MINGW64 /c/Test/msys2.github.io $ git status On branch main Your branch is up to date with 'origin/main'. Changes not staged for commit: (use "git addWhat happened? Why does
git status
show the repo is dirty in MSYS2 shell, but clean in CMD shell?