美文网首页
上传一个项目到GitHub

上传一个项目到GitHub

作者: 三月木头 | 来源:发表于2019-12-28 09:31 被阅读0次
  1. 首先在GitHub创建一个项目文件

  2. 进入本地创建项目所在文件夹Git init创建本地Git 环境

  3. Git add . 将项目加载到暂存区。

  4. Git commit -m "备注描述内容"将项目加载到本地仓库区

  5. git remote add origin https://gitee.com/MarchWood680/Block.git 关联本地库 同 远端库

  6. git push -u origin master(-u表示刚开始远程仓库没有内容,有了内容之后就不用再写了)
    如果新建远程仓库不是空的,例如你勾选了 Initialize this repository with a README。那么你通过命令 $ git push -u origin master是会报错的,如下:

MarchWooddeMacBook-Pro:BlockTest marchwood$ git push -u origin master
To https://gitee.com/MarchWood680/Block.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/MarchWood680/Block.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
MarchWooddeMacBook-Pro:BlockTest marchwood$ 

这是由于你新创建的那个仓库里面的README文件不在本地仓库目录中,这时我们可以通过以下命令先将内容合并以下:

git pull --rebase origin master
  1. git push origin master提交本地项目到远端库

相关文章

  • Android 制作远程依赖库

    首先要上传项目到GitHub上,参考Android:上传项目到GitHub[https://www.jianshu...

  • iOS开发 上传项目到Cocoapod 开源自己的项目记录

    1、在 gitHub 上创建自己的项目,clone 到本地,上传自己的项目到 gitHub (正常上传项目到 gi...

  • 上传项目到github

    一.下载安装git客户端、注册Github账号 客户端下载地址 二.创建ssh 连接github 由于本地Git仓...

  • 上传项目到Github

    1 注册GitHub账号 显然,如果我们需要将代码存放在Github上进行管理,第一步我们需要做的就是注册一个Gi...

  • 上传项目到github

    创建仓库 先在github上创建一个仓库 点击之后看下图: 输入上传项目的名称,点击创建。 上传项目 在你本地的文...

  • 上传项目到github

    https://blog.csdn.net/ashimar_a/article/details/51993731

  • 上传项目到GitHub

    网上的上传过程 上传项目到gitHub PushMeBaby-master处理

  • 上传项目到GitHub

    注册GitHub 账号为yangzc23 创建仓库 仓库名为testin 将远程仓库克隆到本地 检出到本地的D盘d...

  • 上传项目到github

    上传步骤:1、Your profile2、Repositories New3、文件名:demo crea...

  • 上传项目到GitHub

    1、注册github账号。2、创建个人的github仓库,如图, 还可以直接点击右上角的“”+“”添加, 3、创建...

网友评论

      本文标题:上传一个项目到GitHub

      本文链接:https://www.haomeiwen.com/subject/wvnjoctx.html