简体   繁体   English

gitignore 通配符不适用于多个文件扩展名

[英]gitignore wildcard not working with multiple file extensions

Probably a repeat, but I can't find an answer.可能是重复,但我找不到答案。

So I have a .gitignore file:所以我有一个.gitignore文件:

transactions.csv
transactions_test.csv
**/test.gnucash*
test
**/test.gnucash.2*

And the following directory:以及以下目录:

LICENSE    test.gnucash                         transactions_test.csv
main.py    test.gnucash.20180615182021.gnucash  transactions_testPUBLIC.csv
README.md  test.gnucash.20180618121545.gnucash  translations.json
test/      transactions.csv

However when I run git ls-tree -r master --name-only I get:但是,当我运行git ls-tree -r master --name-only我得到:

.gitignore
.vscode/settings.json
LICENSE
README.md
main.py
test.gnucash.20180615182021.gnucash
test.gnucash.20180618121545.gnucash
transactions_testPUBLIC.csv
translations.json

Even weirder than that, if I run this through a glob tester , it works correctly.更奇怪的是,如果我通过glob tester运行它,它可以正常工作。 (see hyperlink) (见超链接)

Any ideas as to what's happening?关于发生了什么的任何想法? I'm running Git for Windows on Windows 10.我在 Windows 10 上运行 Git for Windows。

$ git --version
git version 2.17.0.windows.1

You have already added these files to git, haven't you? 您已经将这些文件添加到git中,不是吗? .gitignore does not affect files already known to git; .gitignore不会影响git已知的文件; it only excludes untracked files from consideration for addition. 它仅将未跟踪的文件排除在考虑之外。

旧帖子但很重要,即使你使用git rm --cached [FILE TO BE REMOVED]它仍然会在 github 上存在提交历史,如果你错误地发布了秘密

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM