windows - Git status 在 cygwin 和 git bash (windows 10) 中给出不同的结果
问题描述
我已经安装了 cygwin(和使用 cygwin 包管理器的 git)和git bash for windows。
我刚刚使用 cygwin shell 克隆了一个存储库,然后在存储库的根目录中打开了一个 git bash shell 和一个 cygwin shell。
然后我git status
从每个 shell 执行。Git bash 发现了更改(文件权限),但 cygwin 没有,我试图了解原因。
以下是详细信息:
Git Bash(显示修改后的文件)
$ git --version
git version 2.23.0.windows.1
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: script.sh
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
diff --git a/script.sh b/script.sh
old mode 100755
new mode 100644
$ git config -l | grep core
core.symlinks=true
core.autocrlf=false
core.fscache=true
core.editor='C:\Program Files (x86)\Notepad++\notepad++.exe' -multiInst -notabbar -nosession -noPlugin
core.editor='C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -nosession
core.autocrlf=false
core.preloadindex=true
core.fscache=true
core.filemode=true
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
Cygwin(未发现任何更改)
$ git --version
git version 2.21.0
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
$ git config -l | grep core
core.editor='C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -nosession
core.autocrlf=false
core.preloadindex=true
core.fscache=true
core.filemode=true
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
所以对于两个炮弹core.filemode=true
。
关于为什么 git bash 选择文件权限更改的任何建议?
解决方案
尝试:
git config core.filemode false
git config core.autocrlf true
如果这样可以解决问题,那么问题就是行尾设置。
如果更改报告为typechange
,则问题可能出在 simlink 和解决方案上:
git config core.symlinks true
此外,请确保在提到的存储库中本地应用这些设置,而不仅仅是全局。
推荐阅读
- c# - WPF:MainWindow黑色背景
- c# - 使用带有验证的属性。要检查的不同类型的属性和值
- java - 使用 Geotools - JAVA 重命名保存为 TableName 的形状文件
- google-cloud-platform - DataFlow输出多个文件
- haskell - 纯功能(持久)环形缓冲区
- vba - 如何在 MS Access 中添加更改记录的表名以及典型的 AuditTrail
- log4j - ServiceMix 功能或捆绑包的单独日志
- typescript - VSCode TSLint 菜单图标
- amazon-web-services - API Gateway SAM 指定 HTTP GET:500 内部服务器错误
- python - 我已经安装了 PyQt,为什么 QAudioFormat 的属性无法识别?