git pull origin master 没有工作

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

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-2.html
匿名

发表评论

匿名网友

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

确定