1 问题复现

在把文件推送到远程仓库时,出现了如下错误。
error: src refspec master does not match any-LMLPHP
错误原因:没有“master”分支。

2 问题解决

1,查看现有分支;

(base) mac@macbook DesignPatterns % git branch
* main

2,创建新分支并转移到新分支;

(base) mac@macbook DesignPatterns % git checkout -b "master"
Switched to a new branch 'master'

3,合并分支;

(base) mac@macbook DesignPatterns % git merge main
Already up to date.

4,重新上传。

(base) mac@macbook DesignPatterns % git push -u origin "master"
Enumerating objects: 48, done.
Counting objects: 100% (48/48), done.
Delta compression using up to 8 threads
Compressing objects: 100% (44/44), done.
Writing objects: 100% (48/48), 9.94 KiB | 3.31 MiB/s, done.
Total 48 (delta 8), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
04-13 13:06