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

第一种 Git Clone


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

聊聊、Git 本地项目上传 GitHub

 

 聊聊、Git 本地项目上传 GitHub

 聊聊、Git 本地项目上传 GitHub

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

聊聊、Git 本地项目上传 GitHub

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

聊聊、Git 本地项目上传 GitHub  聊聊、Git 本地项目上传 GitHub

  

第二种 Git Init 


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

聊聊、Git 本地项目上传 GitHub

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

1.创建 mybatis-annotation

聊聊、Git 本地项目上传 GitHub

2.设置 SSH Keys

聊聊、Git 本地项目上传 GitHub

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

聊聊、Git 本地项目上传 GitHub

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

聊聊、Git 本地项目上传 GitHub

聊聊、Git 本地项目上传 GitHub

 

找到 SSH and GPG keys

聊聊、Git 本地项目上传 GitHub

 New SSH key

聊聊、Git 本地项目上传 GitHub

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

聊聊、Git 本地项目上传 GitHub

最后

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

git push -u origin master

聊聊、Git 本地项目上传 GitHub

 

相关文章:

  • 2021-12-12
  • 2021-04-13
  • 2021-04-02
  • 2022-12-23
  • 2021-06-13
  • 2021-10-15
  • 2021-12-13
猜你喜欢
  • 2021-09-15
  • 2021-06-27
  • 2021-11-30
  • 2021-06-13
  • 2021-12-26
  • 2021-11-04
相关资源
相似解决方案