git - * core.excludesfile 中的 war 导致 git add 忽略 *.p12 文件

标签 git

这太令人困惑了。使用 shell 命令更容易显示。

请注意,我的 ~/.gitconfig[core] 部分指定了 excludesfile =/home/I063510/.gitignore

检查为什么 .p12 被忽略,通过管道传输到 sed 以屏蔽我的用户 ID

$> git check-ignore -v check.p12 | sed -n 's,/home/[^/]*,~,p'
~/.gitignore:11:*.war   check.p12

注释掉带有模式 ^*.war 的行并验证现在没有忽略 .p12 文件

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

更新

我根据 VonC 的回答尝试了 portablegit 并看到了相同的结果:

# 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

最佳答案

I am using cygwin git

尝试使用常规的 Git for Windows ( PortableGit-2.20.1-64-bit.7z.exe ),在 C:\Git 中解压缩,并使用 simplified PATHCMD 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 session 中工作,则可以键入 bash
看看问题是否仍然存在。

关于git - * core.excludesfile 中的 war 导致 git add 忽略 *.p12 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54101805/

相关文章:

git - 补丁在 `git am` 之后没有有效的电子邮件地址

git - git cherry-pick 和 git format-patch 有什么区别?我是 SCSS ?

c# - 检索用于 Jenkins 构建的程序集版本

git - 无法将Jenkins插件发布到jenkins-ci.org

git - 运行 gitk 时出错

git - 将 Angular 2 应用程序部署到 Azure

git - git diff 可以包括最新的作者和修订日期吗?

git - 理解 git cherry-pick

Github - 如何在我的个人资料中显示协作项目?

git - 移动分支,使其从 git 中的 master 分支出来