问题描述
这是如此令人困惑.使用shell命令更容易显示.
This is so confusing. It is easier to show using the shell commands.
请注意,我的〜/.gitconfig
在 [core]
检查为什么.p12被忽略,通过sed屏蔽我的用户ID
check why .p12 is ignored, pipe to sed to mask my user id
$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
~/.gitignore:11:*.war check.p12
用模式 ^ *.war
注释掉该行,并确认.p12文件现在没有被忽略
comment out the line with pattern ^*.war
and verify the .p12 file is not ignored now
$> sed -i.orig 's,^*.war,#&,' ~/.gitignore
$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
$>
还原原始文件并确认.p12被忽略
restore original file and verify .p12 is ignored
$> mv -f ~/.gitignore.orig ~/.gitignore
$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
~/.gitignore:11:*.war check.p12
git版本:
$> git --version
git version 2.17.0
更新
我根据VonC的答案尝试了Portablegit,并看到了相同的结果:
I tried portablegit based on VonC's answer and see the same result:
# git check-ignore -v check.p12
# git config core.excludesfile c:/temp/.gitignore
# git check-ignore -v check.p12
c:/temp/.gitignore:1:*.war check.p12
# git --version
git version 2.20.1.windows.1
更新2 忘了提及,这种情况仅发生在〜core.excludesfile〜
中的模式中,而不发生在〜core.workdir〜/.gitignore
UPDATE 2Forgot to mention, this happens only for the pattern in ~core.excludesfile~
, not in ~core.workdir~/.gitignore
推荐答案
尝试并使用常规的适用于Windows的Git ( PortableGit-2.20.1-64-bit.7z.exe
),在 C:\ Git
中解压缩,并使用:
Try and use the regular Git for Windows (PortableGit-2.20.1-64-bit.7z.exe
), uncompress in C:\Git
, and with a simplified PATH in a CMD
session:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%
然后,如果要在bash会话中工作,则可以键入 bash
.
看看问题是否仍然存在.
Then you can type bash
if you want to work in a bash session.
See if the issue persists then.
这篇关于* core.excludesfile中的war导致git add忽略* .p12文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!