当前位置:   article > 正文

error: src refspec master does not match any

error: src refspec master does not match any

1 问题复现

在把文件推送到远程仓库时,出现了如下错误。
请添加图片描述
错误原因:没有“master”分支。

2 问题解决

1,查看现有分支;

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

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

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

3,合并分支

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

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/586046
推荐阅读
相关标签
  

闽ICP备14008679号