0


git解决.gitignore不生效

1).gitignore规则的语法错误
排查语法问题,修正错误的语法。

2)git缓存
使用git清除本地缓存,然后提交。命令如下:

git rm -r --cached .             # 删除缓存
git add -A                       # 重新添加所有文件,等价写法:git add .          
git commit -m "update"          # 重新提交
git push -u origin master       # 推送

.gitignore文件只会在第一次提交项目的时候写入缓存,如果第一次提交项目时候忘记添加.gitignore文件,后来再补上是没有用的,.gitignore文件是不生效的。因为在缓存中已经标记该项目是不存在ignore文件的。

标签: git github

本文转载自: https://blog.csdn.net/m0_47136198/article/details/127993956
版权归原作者 不知言愁 所有, 如有侵权,请联系我们删除。

“git解决.gitignore不生效”的评论:

还没有评论