如果出现该错误提示,可能是因为使用了旧命令:
git pull origin master
master现在被认为是有种族歧视的,github将其换成了main,所以现在使用pull可以写为:
git pull origin main
如需要将已有repos的master
换为main
,可依照以下步骤:
-
1-重命名本地分支:
git branch -m master main
-
2-重命名远程分支
git checkout main git push -u origin main
-
3-删除远程分支
master
文章来源:https://www.toymoban.com/news/detail-698171.htmlgit push origin --delete master
-
4-告知团队中的其他人更新他们的本地库,方法如下:文章来源地址https://www.toymoban.com/news/detail-698171.html
# Switch to "master" branch git checkout master # Rename "master" branch to "main" git branch -m master main # Get latest commits and branches from remote git fetch # Remove existing connection with "master" git branch --unset-upstream # Create connection with new "main" branch git branch -u origin/main
到了这里,关于Git error:‘fatal: Couldn‘t find remote ref master‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!