Adding .gitignore doesn't work

Problem Description

Since the code contains some files that do not need to be uploaded, they are generally created in git .gitignore. For details, please refer to
.gitignore

However, unneeded saved files are often uploaded to the temporary storage area staged, resulting in .gitignoreno corresponding effect.

Solution

untracked status

git rm -r --cached .

Roll back the contents of the staging area to

git restore --staged <file>

Then, execute

git add .

Guess you like

Origin blog.csdn.net/frighting_ing/article/details/130308962