1.首先在git bash中创建.gitignore文件(在你想要上传的文件夹的目录下,与.git文件同级)
touch .gitignore
2.在git bash中使用命令git rm -r --cached .清空缓存。
git rm -r --cached
因为如果想要忽略某文件,该文件就不应该被追踪
通过该命令可以直接清空本地mode
3. 然后开始正常操作,将本地文件,准备重新提交到本地
git add .
git commit -m "update .gitignore"
可以看到commit之后,将一些我忽略的文件delete mode,表示不提交这些文件
4.提交到远程仓库
git push
共勉!