上传及更新代码到github(以及如何在vscode上提交自己的代码)

 

一、上传本地代码

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

红框为新建的仓库的https地址

在git bash里输入上面图片提示要输入的命令的6句话

第二步:添加readme内容

第三步:建立git仓库

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

第五步:把readme添加到项目中

第六步:提交到仓库-m为添加注释语句

第七步:将本地的仓库关联到GitHub,后面的https改成刚刚自己的地址,上面的红框处

第八步:上传github之前pull一下

第九步:上传代码到GitHub远程仓库

echo "# artillery-" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/chenxiaomeng362246/artillery-.git
git pull origin master git push -u origin main

 

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

 

 

 

更新代码

第一步:查看当前的git仓库状态,可以使用git status

git status

第二步:更新全部

git add *

第三步:接着输入git commit -m "更新说明"

git commit -m "更新说明"

第四步:先git pull,拉取当前分支最新代码

git pull

第五步:push到远程master分支上

git push origin master

不出意外,打开GitHub已经同步了

//-------------------------------------------------------------------------------

如何在vscode上提交代码到github

1:

 2:

 

3:

 

声明 欢迎转载,但请保留文章原始出处:) 博客园:https://www.cnblogs.com/chenxiaomeng/ 如出现转载未声明 将追究法律责任~谢谢合作
原文地址:https://www.cnblogs.com/chenxiaomeng/p/15104542.html