在做Demo时没来得及设置.gitignore文件,把node_modules也push上去了,取他山之玉,攻自山之石。

1、先新建.gitignore文件,设置忽略文件。

windows系统下用记事本新建文件,写入忽略文件,另存为所有文件(.)格式,更改文件名为.gitignore即可。

2、在命令行进入仓库目录,删除github仓库上.gitignore上新加的选项

git rm -r --cached .

3、然后重新添加要提交的选项

git add .

4、接着commit,简要说明一下commit的内容

git commit -m “remove node_modules”

5、最后在git push 到远程仓库上就可以了

git push