如何将项目加载到 Github
How to load the project into Github
当我将我的项目加载到 Github 时,它会提示我“提交失败”。我用的是bower和nodeJS,我觉得问题出在这上面,但是我需要下载这些目录。我需要做什么,或者可以通过其他方式完成?
你不应该犯 node_modules
也不 bower_components
。您应该将您的依赖项分别保存在 package.json
和 bower.json
中,并且在克隆/签出您的项目时,您应该安装您的依赖项。
将 node_modules/
和 bower_components/
添加到您的 .gitignore
(阅读 here 关于编辑您的 .git 忽略)将使 git "forget" 这些目录存在。
这也会减小项目的大小。
为了创建 package.json
如果您缺少但已经安装了依赖项,您可以使用 npm shrinkwrap
.
您不必提交 node_modules
和 bower_components
解决方案:如果您已经有 .gitignore
文件然后编辑它,或者如果您没有创建它并编辑。添加 node_modules
和 bower_components
的路径。喜欢:
node_modules
bower_components
自动忽略目录的方法
这些文件夹应该在安装时通过依赖管理器 installed/populated(分别为 npm
和 bower
)。
您应该按照 this 在项目的根目录中创建一个 .gitignore
文件。这应该添加到 git 以便它也可以与存储库一起克隆到其他机器上。
# cat .gitignore
node_modules
bower_components
还有一个webservice生成.gitignore
个文件,很全面。这是 node
和 bower
:
# Created by https://www.gitignore.io
### Node ###
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
### Bower ###
bower_components
.bower-cache
.bower-registry
.bower-tmp
当我将我的项目加载到 Github 时,它会提示我“提交失败”。我用的是bower和nodeJS,我觉得问题出在这上面,但是我需要下载这些目录。我需要做什么,或者可以通过其他方式完成?
你不应该犯 node_modules
也不 bower_components
。您应该将您的依赖项分别保存在 package.json
和 bower.json
中,并且在克隆/签出您的项目时,您应该安装您的依赖项。
将 node_modules/
和 bower_components/
添加到您的 .gitignore
(阅读 here 关于编辑您的 .git 忽略)将使 git "forget" 这些目录存在。
这也会减小项目的大小。
为了创建 package.json
如果您缺少但已经安装了依赖项,您可以使用 npm shrinkwrap
.
您不必提交 node_modules
和 bower_components
解决方案:如果您已经有 .gitignore
文件然后编辑它,或者如果您没有创建它并编辑。添加 node_modules
和 bower_components
的路径。喜欢:
node_modules
bower_components
自动忽略目录的方法
这些文件夹应该在安装时通过依赖管理器 installed/populated(分别为 npm
和 bower
)。
您应该按照 this 在项目的根目录中创建一个 .gitignore
文件。这应该添加到 git 以便它也可以与存储库一起克隆到其他机器上。
# cat .gitignore
node_modules
bower_components
还有一个webservice生成.gitignore
个文件,很全面。这是 node
和 bower
:
# Created by https://www.gitignore.io
### Node ###
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
### Bower ###
bower_components
.bower-cache
.bower-registry
.bower-tmp