Qt Git 忽略 CMakeLists.txt.user 文件失效的解决方法
如果您已经将 'CMakeLists.txt.user' 文件添加到 '.gitignore' 中,并且没有将其提交到 Git 中,但是它仍然没有被忽略,则可能是因为该文件已经被添加到 Git 缓存中。在这种情况下,您需要先从 Git 缓存中删除该文件,然后再将其添加到 '.gitignore' 中。
您可以使用以下命令从 Git 缓存中删除该文件:
git rm --cached CMakeLists.txt.user
然后,将 'CMakeLists.txt.user' 文件添加到 '.gitignore' 中:
echo 'CMakeLists.txt.user' >> .gitignore
然后再次提交并推送您的更改。
git add .gitignore
git commit -m 'Ignoring CMakeLists.txt.user file'
git push
这样就应该可以忽略 'CMakeLists.txt.user' 文件了。
原文地址: https://www.cveoy.top/t/topic/nzM8 著作权归作者所有。请勿转载和采集!