聊聊、Git 本地项目上传 GitHub

相信大家对 SVN,CVS,Git 都比较熟悉,都是代码管理工具。今天聊聊 Git 本地项目远程上传问题。

第一种 Git Clone


首先登录 github.com 创建一个仓库 dubbo-spring-boot-starter

 

 

到这里就创建完成了,如果你电脑没有安装 git,可以去下载 https://git-for-windows.github.io,安装完成右键选择 Git Bash Here 打开 Git Bash 操作窗口。 

clone 下来 dubbo-spring-boot-starter 项目,然后在里面添加代码文件提交即可,例如:我在项目里面新增 readme.md 文件。

  

  

第二种 Git Init 


先本地创建项目 E:ideamybatis-annotation,进入 E:ideamybatis-annotation,同样新增文件 readme.md ,右键 Git Bash Here 弹出窗口,输入命令 git init,将 mybatis-annotation 项目变成 git 项目

git commit 之后,不能直接 git push -u origin master,需要在 github 上面创建项目,然后与 mybatis-annotation 进行关联,而且需要设置 SSH Keys

1.创建 mybatis-annotation

2.设置 SSH Keys

输入 ssh-keygen -t rsa -C "mial@126.com",你自己的邮箱地址,会在路径下生成两个文件

复制 id_rsa.pub 内容,然后登录 github.com 进行 settings

找到 SSH and GPG keys

 New SSH key

Title 随便取名,Key 就是复制的 id_rsa.pub 内容,添加完毕

最后

git remote add origin https://github.com/xumiaoshun/mybatis-annotation.git

git push -u origin master

原文地址:https://www.cnblogs.com/xums/p/12692688.html