我试图通过 VSCode 使用 git,因为我不知道如何在 VSCode 上使用 Git,所以一切都搞砸了。
然后我尝试像往常一样使用CMD(Windows)。我正在学习,以前从未见过这种错误,所以我不知道如何解决这个问题。
但当我尝试推送到主分支时,它显示了这些错误:
error: src refspec main does not match any
error: failed to push some refs to 'myPathToRepo'
Run Code Online (Sandbox Code Playgroud)
我试过:
我在 StackOverflow 上看到过其他帖子,大多数都说“先提交然后推送,因为当您在未提交的情况下推送时会出现此错误”。
删除.git/文件夹并重新启动后,它开始显示相同的错误
>git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
>git push -u origin main
error: src refspec main does not match any
error: failed to …Run Code Online (Sandbox Code Playgroud)