节点模块推送到GitHub [英] Node modules pushed to GitHub

查看:67
本文介绍了节点模块推送到GitHub的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的项目推送到github和heroku.由于我在我的应用程序中使用nodejs,因此我具有node_modules.在提交之前,我已经创建了一个名为.gitignore的文件以忽略节点模块.

I am trying to push my project to github and heroku. Since I am using nodejs in my app , I have node_modules. Before I commit I have created a file called .gitignore to ignore the node modules.

在文件中,我添加了node_modules并尝试从comandline/Terminal推送到GitHub.我没想到节点模块会被推送,但是它们最终出现在仓库中.在这方面我有什么必须遵循的方法,我需要帮助;谢谢!

Inside the file I have added node_modules and tried to push to the GitHub from the comandline/Terminal. I was not expecting the node modules to be push but they appeared finally in the repo. Is there any ways i have to follow , i need help in this regards; thanks!

- $ git rm -r --cached node_modules 将node_modules/添加到您的.gitignore文件 - $ git commit -m "remove the ignored directory node_modules" 接着 - $ git push origin master 之后,如果刷新GitHub页面,您将看到node_modules消失了.

- $ git rm -r --cached node_modules add node_modules/ to your .gitignore file - $ git commit -m "remove the ignored directory node_modules" and then - $ git push origin master After that , if you refresh the GitHub page you will see the node_modules gone.

推荐答案

应将node_modules文件夹添加到.gitignore文件中.

The node_modules folder should be added to the .gitignore file.

首先,摆脱您的node_modules:

$ git rm -r --cached node_modules  
$ git commit -m "remove node_modules"

然后,推动您的更改

$ git push origin master

刷新页面以查看所需的效果.

Refresh the page to see the desired effect.

这篇关于节点模块推送到GitHub的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆