在 .gitignore 文件中添加 “App/Runtime/*” 后,如果之前已经跟踪了 App/Runtime 目录下的文件,那么这些文件不会被自动忽略。.gitignore 只对未跟踪的文件生效。

要解决这个问题,你需要先从 Git 仓库中移除这些已经被跟踪的文件,但不删除物理文件。可以使用以下命令: git rm -r --cached App/Runtime 这个命令会将 App/Runtime 目录下的文件从 Git 的跟踪中移除,但文件本身不会被删除。

然后再提交这个变更:

git commit -m "Untrack App/Runtime directory" 之后,App/Runtime 目录下的文件就会被 .gitignore 忽略了。