Wordpress git更改不会忽略gitignore文件中设置的文件/文件夹

Wordpress git更改不会忽略gitignore文件中设置的文件/文件夹,wordpress,git,Wordpress,Git,我有下面的git.gitignore文件用于wordpress站点 # ignore everything in the root except the "wp-content" directory. !wp-content/ # ignore everything in the "wp-content" directory, except: # "mu-plugins", "plugins", "th

我有下面的git.gitignore文件用于wordpress站点


# ignore everything in the root except the "wp-content" directory.
!wp-content/

# ignore everything in the "wp-content" directory, except:
# "mu-plugins", "plugins", "themes" directory
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/

# ignore these plugins
wp-content/plugins/hello.php

# ignore specific themes
wp-content/themes/twenty*/

# ignore node dependency directories
node_modules/

# ignore log files and databases
*.log
*.sql
*.sqlite

现在,当我对wp_config.php文件或wp content文件夹git中的任何其他文件进行一些更改时,请计算要更改的文件并弹出提交更改的选项。
我正在使用VS代码编辑器。

在初始化repo(运行
git init
)后是否创建了.gitignore文件

如果是,则需要清除Git的缓存。尝试在命令行上运行gitrm-r--cached.