本地仓库上传远程仓库(githu

1、将本地仓库上传github简明过程

在本地建立仓库并将仓库上传github步骤
git init git add README.md git commit -m "first commit" git branch -M master git remote add origin https://github.com/Polaris-zhj/stm32.git git push -u origin master
 本地有仓库上传github的过程
git remote add origin https://github.com/Polaris-zhj/stm32.git
git branch -M master
git push -u origin master

2、本地仓库上传github详细过程

2.1、在GitHub上创建项目

能够将本地仓库上传远程github仓库的前提,github中建立了一个仓库

  • 新建仓库

  • 填写项目信息

 

  • 创建完毕

2.2、使用Git命令提交项目到GitHub

2.2.1 在本地初始化一个git仓库

 2.2.2 创建一个文件(实际操作中可能是修改等其他操作)

2.2.3 将文件提交到暂存区

git add <修改或添加的文件名>

2.2.4 将暂存区文件提交到本地仓库中

git commit -m '<对暂存区文件上传到本地仓库的说明或者说修改原因>'

 

2.2.5 查看分支名并修改

说明:再上传时一般不会直接上传到主分支上,因此将分支名称修改上传,如果此时github中所链接的仓库内没有该分支,在push过程中能够自动建立分支(下文展示)

2.2.6 添加远程版本库

git remote add [name] [url]  作用是添加远程版本库
name 是自己取的仓库的名字;      url 是地址
说明:就是给远程仓库的链接起一个别名[name]

2.2.7 将本地仓库推到远程仓库中

git push -u origin gitTest
相当于
git branch --set-upstream-to=origin/gitTest gitTest     //将远程仓库origin的master分支与本地仓库master分支关联

git push origin gitTest

注意:在密码输入时,需要在token中申请的密码才能使用,

如何生成token密码:https://blog.csdn.net/qq_41646249/article/details/119777084?spm=1001.2014.3001.5506

 

 

posted @ 2022-09-11 10:07  北极星!  阅读(43)  评论(0编辑  收藏  举报