*war in core.excludesfile causes git add to ignore *.p12 files

Viewed 167

This is so confusing. It is easier to show using the shell commands.

Note that my ~/.gitconfig specifies excludesfile = /home/I063510/.gitignore in section [core]

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

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'
$> 

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 version:

$> git --version
git version 2.17.0

UPDATE

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

UPDATE 2 Forgot to mention, this happens only for the pattern in ~core.excludesfile~, not in ~core.workdir~/.gitignore

1 Answers

I am using cygwin 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%

Then you can type bash if you want to work in a bash session.
See if the issue persists then.

Related