git pull origin master 不起作用

huangapple go评论107阅读模式
英文:

git pull origin master not wokring

问题

每当我尝试推送我的git时,也就是使用命令"git push -u origin master"时,我会得到以下错误信息:

"error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/Username/gitname'"

我尝试了"git pull origin master"命令,但遇到了以下错误信息:

"fatal: couldn't find remote ref master"

你可以在这里找到解决方法:https://www.freecodecamp.org/news/error-failed-to-push-some-refs-to-how-to-fix-in-git/

英文:

Whenever i try to push my git that is when i use "git push -u origin master" this command
I get "error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/Username/gitname' "

I tried "git pull origin master" and ran into "fatal: couldn't find remote ref master" this error
which i found here https://www.freecodecamp.org/news/error-failed-to-push-some-refs-to-how-to-fix-in-git/

答案1

得分: 1

推送不起作用是因为你的本地仓库中似乎没有名为"master"的分支。尝试只使用git push -u origin(不带引用名称),然后Git将默认推送到当前分支。
或者,检查你当前分支的名称(git branch),然后执行git push -u origin <branchname>

类似地,我猜拉取操作不起作用是因为远程仓库中没有名为"master"的分支。

英文:

The push does not work because it seems like there is no branch named "master" in your local repository. Try just git push -u origin (so without ref name), then Git will push will default to the current branch.
Alternatively, check the name or your current branch (git branch) and then do git push -u origin &lt;branchname&gt;.

Similarly, I suppose the pull does not work because the remote does not contain a branch named "master".

huangapple
  • 本文由 发表于 2023年8月9日 14:10:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/76865010.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定