问题:pathspec master did not match any file(s) known to git

执行 $ git checkout master 时提示

pathspec master did not match any file(s) known to git

$ git branch -a 查看分支 发现分支情况为

 * main
   dev  (我自己建的分支)

并不存在 master。查询了下解决方法,链接: link.

主要步骤贴上:

git checkout -b main
# Switched to a new branch 'main'
git branch
# * main
#  master
git merge master # 将master分支合并到main上
# Already up to date.
git pull origin main --allow-unrelated-histories # git pull origin main会报错:refusing to merge unrelated histories
git push origin main

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐