git-push有效,但git-push-原始主机无效



我在Windows 10上使用Git Bash。我已经将一个存储库克隆到我的电脑上,向其中添加文件并提交。

当我尝试命令时:

git push origin master

我得到这个错误:

fatal: couldn't find remote ref master

但是,如果我尝试一个简单的git push,则不会出现错误,并且这些更改会反映在我的远程回购中。pull命令也是如此。出了什么问题,我该如何解决?

编辑:根据评论和答案,我将添加此信息

当我做git branch -avv时,我得到以下输出:

* main                f42878d [origin/main] Added some more Week 1 problems
remotes/origin/HEAD -> origin/main
remotes/origin/main f42878d Added some more Week 1 problems

所以,我尝试了其中一个答案,那就是尝试git push origin main而不是git push origin master。这是我的输出:

warning: setting remote service path not supported by protocol
Logon failed, use ctrl+c to cancel basic credential prompt.
warning: setting remote service path not supported by protocol
Everything up-to-date

这似乎确实有效,但在此之前也有警告。我在谷歌上搜索了警告,找到了这个Stackoverflow的答案。根据接受的答案,我以管理员身份运行GitBash,但警告仍然存在。发生的情况是,身份验证发生了两次:一次通常是通过GitHub登录对话框,我在对话框中输入用户名和密码。此操作失败,然后出现一个OpenSSH对话框,我在其中提供用户名和密码。这是有效的。

我是Git Bash的新手,所以我不知道该何去何从。

尝试使用git push origin main这是因为在GitHub中,master被寻址为main。

最新更新