这篇文章出现的起因是后续增加.gitignore文件但是不生效。
先使用下面指令清除缓存:
git rm -r --cached .
然后重新添加:
git add .
重新提交:
git commit -m 'update'
最后push:
git push -u origin master
需要注意的是,我使用了上面的指令提交,但是没用,使用上面这行push后会出现报错,使用下面这行,强制提交后就解决了:
git push -f
使用下面这行行代码配置全局的.gitignore:
git config --global core.excludesfile ~/.gitignore