1、在自己项目路径中打开git cmd(此时项目文件夹内没有.git文件)
2、git init(创建.git文件)
3、git remote add origin 复制的远程项目地址(origin是你为远端仓库所起的名字)
4、git pull origin master(远程master分支是自己创建的,默认分支是main)
5、git add .(这个命令后面有一个 “ . ” ,点代表所有,也可以写某个文件名称)
6、git commit -m “提交项目”
7、git push origin master
此时报错error: src refspec master does not match any
解决:git branch
发现本地分支名是main,而远程分支名是master,修改本地分支名字为master
git branch -m main master
此时成功解决,本地分支和远程分支同名可以解决问题,但问题的原因不是分支名不同。