该文章记于2023.01.11
1.初始化
git init
2.添加远程仓库地址
git remote add origin urlxxx
3.配置当前项目的用户名、邮箱
// 查看当前项目的用户名和邮箱
git config user.name
git config user.email
// 符合提交用户名和邮箱,以下可省略
git config user.name 'helen'
git config user.email 'helen@helen'
4.拉取远程分支
注意远程分支的名字,github新建项目时,分支默认名字main,对应以下代码,master替换成main即可
git pull origin master
5.推送本地代码
git add .
git commit -m 'new push'
git push origin master
6.修改远程项目默认分支
选择setting,找到branches,切换分支
当setting没有branches时候,说明新建仓库没有分支,直接本地分支推送到远程仓库即可