node-modules - 推送 node_modules 但无法弄清楚如何删除
问题描述
我将节点模块推送到 GitHub,然后意识到我没有.gitignore
.
我添加了,gitignore
但它没有解决问题。
我在这里找到了答案,说要从缓存中删除它git rm -r --cached node_modules
,但这不起作用,因为它说它找不到该文件,我仍然可以在我的仓库中看到它。
我的文件结构是 repo,然后是一个dev
包含在其中的文件夹node_modules
,以及我编写的所有其他代码。
位于文件夹.gitignore
之外,位于dev
文件旁边README
。
我是否需要提供.gitignore
a 路径来查找 a 之类的模块./node_modules
?
解决方案
gitignore 位于自述文件旁边的 dev 文件夹之外
然后,它应该包括:
dev/node_modules/
那将忽略dev/node_modules
文件夹及其内容。
检查(git rm --cached dev/node_modules
从你的仓库的根文件夹完成后):
git check-ignore -v -- dev/node_modules/afile
(在该文件夹内的一个现有文件上测试它dev/node_modules/
)
推荐阅读
- google-cloud-platform - 如何为 Google Cloud Functions 配置自定义域以呈现 HTML
- github - 还有哪些其他方法可以在 GitHub 上发现非中文的热门存储库?
- ios - Swift iOS - setContentHuggingPriority 优先考虑错误的标签
- node.js - 为什么当我控制台记录 imageUrl 时,我会变得不确定?
- python - 如何使用 Python 类属性作为 @Classmethod 的默认值?
- parsing - Gnu Bison shift /减少描述层次表达式的基于缩进的语法中的冲突
- css - 图标字体的CSS字体系列后备?
- android - 使用 animateToRegion() 与 animateCamera() 的优缺点
- ansible - 如何检查字符串中的几个关键字并断言是否不存在于 Ansible 任务中
- sockets - 同步 I/O 是否使线程忙?