这太让人困惑了。使用shell命令更容易显示。
注意我的
~/.gitconfig
指定
excludesfile = /home/I063510/.gitignore
[core]
检查原因。p12被忽略,管道到sed以屏蔽我的用户id
$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
~/.gitignore:11:*.war check.p12
用图案标出线条
^*.war
$> sed -i.orig 's,^*.war,#&,' ~/.gitignore
$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
$>
还原原始文件并验证是否忽略.p12
$> 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
更新
# 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
忘了说,这种情况只发生在
~core.excludesfile~
,不在
~core.workdir~/.gitignore