第一步:建立git仓库 
cd到你的本地项目根目录下,执行git命令

git init #初始化项目

第二步:将项目的所有文件添加到仓库中

git add . 或者git add -A  #如果想添加某个特定的文件,只需把.换成特定的文件名即可

第三步:将add的文件commit到仓库

git commit -m "注释语句" #写注释信息

第四步:去github上创建自己的Repository,创建页面如下图所示:

点击下面的Create repository,就会进入到类似下面的一个页面,拿到创建的仓库的https地址,红框标示的就是 

第五步:重点来了,将本地的仓库关联到github上

git remote add origin https://github.com/xxxxx/Group_SocialBank/MicroBank.git  #本地代码与服务器代码关联,后面的https链接地址换成你自己的仓库url地址,也就是上面红框中标出来的地址

第六步:上传github之前,要先pull一下,执行如下命令:

git pull origin master #把代码从服务器拉下来

敲回车后,会执行输出类似如下 

第七步,也就是最后一步,上传代码到github远程仓库

git push -u origin master #本地代码上传到服务器

执行完后,如果没有异常,等待执行完就上传成功了,中间可能会让你输入Username和Password,你只要输入github的账号和密码就行了!

PS:

如果上传过程pull代码过程出现这个错误fatal: refusing to merge unrelated histories,

需要增加--allow-unrelated-histories

即:git pull origin master --allow-unrelated-histories

 

170821、本地代码上传gitlub的更多相关文章

  1. 将本地代码上传至github备份的操作方法

    这篇文章写得是windows下的使用方法. 第一步:创建Github新账户 第二步:新建仓库 第三步:填写名称,简介(可选),勾选Initialize this repository with a R ...

  2. 本地代码上传到github

    一,注册Github账号 1.先注册一个账号,注册地址:https://github.com/ 2.登录后,点击start a project 3.创建一个repository name,输入框随便取 ...

  3. 【GitHub】本地代码上传

    本地代码上传GitHub 2019-11-18  20:03:45  by冲冲 1.注册GitHub https://github.com/ 2.安装Git工具 https://git-for-win ...

  4. 将本地代码上传到github

    准备工作上传本地代码到github 准备工作 在github上创建自己的Repository. 安装git,centos的git安装教程. 上传本地代码到github git init git add ...

  5. 将本地代码上传github

    建立本地仓库 1.首先进入text文件夹 cd d:text 首先进入text文件夹 2.执行指令:git init 执行git init 初始化成功后你会发现项目里多了一个隐藏文件夹.git 隐藏的 ...

  6. git基本操作:使用git将本地代码上传到GitHub

    一.创建github repository(仓库) 1.登录GitHub 创建GitHub仓库,首先需要登录GitHub,GitHub网址:https://github.com.如果没有GitHub账 ...

  7. windows本地代码上传github

    1.下载Git工具 https://www.git-scm.com/download/win 2.进到项目目录 cd /dir/dir/dir/file 3.初始化 git init 4.添加远程仓库 ...

  8. 将本地代码上传至github

    注册github账号 https://github.com/ 安装git工具 https://git-for-windows.github.io 1.在github中创建一个项目 2.填写相应信息,点 ...

  9. 如何将本地代码上传到Github

    这些内容只是Git知识的冰山一角 更多知识请 阅读 Pro git.Pro git 所有内容均根据知识共享署名非商业性共享3.0版许可证授权,各位可以免费下载阅读,有pdf.mobi.qpub格式可以 ...

随机推荐

  1. [OpenCV] Samples 01: Geometry - 几何图形

    前言 基本的几何图形,标注功能. commondLineParser的使用参见:http://blog.csdn.net/u010305560/article/details/8941365 #inc ...

  2. ios开发之--调试方法

    概述 基本操作 全局断点 条件断点 开启僵尸对象 LLDB命令 概述 在开发项目的工程中,肯定会遇到各种各样的bug,且大多数的bug都和自己有关:那么在和bug斗智斗勇的过程中,如果能快速准确的一击 ...

  3. mysql报错“Starting MySQL...The server quit without updating PID file”处理

    http://blog.csdn.net/lzq123_1/article/details/51354179 注意:要将/usr/bin/mysql_install_db替换成 /usr/bin/my ...

  4. MySQL实现树状所有子节点查询的方法

    本文实例讲述了MySQL实现树状所有子节点查询的方法.分享给大家供大家参考,具体如下: 在Oracle 中我们知道有一个 Hierarchical Queries 通过CONNECT BY 我们可以方 ...

  5. ssh面密码登录配置-hadoop安装准备

    1. 用ssh-keygen创建公钥,一直回车即可 root@kali:~# ssh-keygen -t rsa Generating public/private rsa key pair. Ent ...

  6. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing ___Error Installing APK

    一 : 根据以下路径,找到Instant Run中的选项         File —— Settings——Build,Execution,Deployment——Instant Run       ...

  7. php curl那点事儿

    curl是最常用功能之一初始化句柄 $ch = curl_init(); post 传$data 1. 如果$data是字符串,则Content-Type是application/x-www-form ...

  8. java多线程例子(生成者和消费者)

    Info.cs 商品 public class Info { boolean flag=false; private String name="张三"; private int a ...

  9. 【python3】 django2.0 在生成数据库表时报错: TypeError: __init__() missing 1 required positional argument: 'on_delete'

    python: 3.6.4 django: 2.0 models.py 代码如下 # coding: utf-8 from django.db import models from django.co ...

  10. JWNL的配置使用

    JWNL是什么? JWNL is an API for accessing WordNet-style relational dictionaries. It also provides functi ...