为什么 .gitignore 在 Pycharm 中不起作用?它仍然跟踪 ./idea 下文件的更改

Pha*_*ang 4 python git gitignore pycharm

我已经在 Pycharm 中为我的团队项目设置了项目解释器。我已经从 Git 克隆了它。我们已在 .gitignore 中的 .idea 文件夹下列出了该文件。但每次我设置项目解释器时,Pycharm 都会将这些文件跟踪为更改的文件。这是我们的 gitignore

*.pyc
doc/.*
partner/.*
.settings/
doc
tests/test.py
tests/format_db.py
nohup.out
crawler/uber.py
.idea/*
.vscode/*
broadcast.log
last_commit.txt
Run Code Online (Sandbox Code Playgroud)

Anu*_*har 13

您必须从 git 的缓存中删除文件。

git rm --cached file1 file2 dir/file3
Run Code Online (Sandbox Code Playgroud)

来源:如何删除 .gitignore 中列出但仍在存储库中的文件?