学习 nodejs 时不小心把 node_modules 提交到了 github,经过在网上搜索并试验可行,现记录如下:
1.先在.gitignore文件上编写一下代码
1 | node_modules/ |
2.在命令行进入仓库目录,删除 github 仓库上 .gitignore 上新加的选项
1 | git rm -r --cached . |
3.然后重新添加要提交的选项
1 | git add . |
4.接着 commit,简要说明一下commit的内容
1 | git commit -m 'remove node_modules' |
5.最后在 git push 到远程仓库上就可以了。
1 | git push |