美文网首页
git删除项目中的.gitignore文件;但依然有项目文件未跟

git删除项目中的.gitignore文件;但依然有项目文件未跟

作者: hao102 | 来源:发表于2019-12-16 19:37 被阅读0次

事件起因:我在项目中想提交一个.txt文件;但是add时却告诉我 The following paths are ignored by one of your .gitignore files
我删除项目中的忽略文件照样无法提交;这里我们就遗忘掉了一点是,git存在全局gitignore
修改方法:mac电脑
1.修改全局的忽略文件

vim ~/.gitignore_global

2.移除.gitignore忽略文件的缓存

git rm -r --cached .

3.从新添加并提交

git add .
git commit -m 'update .gitignore'

搞定;现在你应该能够提交你原来的忽略文件了

相关文章

网友评论

      本文标题:git删除项目中的.gitignore文件;但依然有项目文件未跟

      本文链接:https://www.haomeiwen.com/subject/cmndnctx.html