【问题标题】:How to upload a full-stack (ReactJS , NodeJS , socketIO) project to github by git bash command line如何通过 git bash 命令行将全栈(ReactJS、NodeJS、socketIO)项目上传到 github
【发布时间】:2021-08-13 07:33:51
【问题描述】:

我刚刚建立了一个关于实时聊天的项目,现在我只想把它上传到 github reposity 我的文件夹结构看起来像这样 enter image description here

不知道如何通过git bash命令行将整个项目上传到github

我已经阅读了 github 文档,但我每次只能上传 1 个文件夹(每次只能上传“客户端”或“服务器”文件夹),有人可以告诉我如何上传整个文件夹(“聊天应用程序” " 文件夹) 到 github?

【问题讨论】:

  • 你必须在你的父目录中启动 git 或者说 git init,在这个目录中,不同项目的不同文件夹,你必须从那里提交和推送

标签: node.js reactjs git express socket.io


【解决方案1】:
  • 首先,确保您的 gitignore 包含以下内容:

/node_modules

它将阻止 git 上传 node_module(您可以使用 npm install 轻松重新创建)。

  • 然后你可以在你的文件夹(聊天应用程序)中做一个git init。它将创建一个新的本地 Git 存储库

然后,您可以在此文件夹中使用 git 的全部功能。

  • 然后您必须将修改后的文件添加到 stage。这里有很多可能性,有些使用git add .git add -A,或者您可以逐个文件git add [filename](不带括号)

  • 之后,您可以通过消息提交您的修改,告诉您所做的修改:git commit -m "my super commit message"

  • 您还必须指定 git 一个 远程存储库 git remote add [name] [url](例如:git remote add github http://github.com/myUsername/myRepo.git

  • 最后你可以push你的修改:git push [remoteName] [remoteBranch] (git push github master)

【讨论】:

    猜你喜欢
    • 2015-02-11
    • 2020-06-26
    • 2023-03-11
    • 2013-07-07
    • 2021-11-19
    • 1970-01-01
    • 2020-05-04
    相关资源
    最近更新 更多