在 Git 中找不到远程引用 HEAD

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20185082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:21:37  来源:igfitidea点击:

Couldn't find remote ref HEAD in Git

gitversion-controlbonobo

提问by shanmugharaj

I installed bonobo git server on windows 7.

我在 Windows 7 上安装了 bonobo git 服务器。

I created a new repository "SFK" through that bonobo.

我通过那个倭黑猩猩创建了一个新的存储库“SFK”。

Then I cloned into that like:

然后我克隆成这样:

git clone http://localhost/Bonobo.Git.Server/SFK.git
git add "trans.cs"
git commit -m "added"
git push http://localhost/Bonobo.Git.Server/SFK.git

Everything works.

一切正常。

Bit When I try to pull using

位当我尝试使用

git pull http://localhost/Bonobo.Git.Server/SFK.git

It gives this error

它给出了这个错误

fatal:
Couldn't find remote ref HE
Unexpected end of command stream

Where am I going wrong? I am new to this git and bonobo. please suggest how to rectify this.

我哪里错了?我是这个 git 和 bonobo 的新手。请建议如何纠正这个问题。

UPDATE:

更新:

I tried this after push.

推后我试过这个。

git config --global pull.default current
git config --global push.default current

It worked.

有效。

采纳答案by VonC

Those settings allow git to know what to push to or what to pull from:

这些设置允许 git 知道要推送到什么或从什么中拉出:

push the current branch to update a branch with the same name on the receiving end. Works in both central and non-central workflows.

推送当前分支以更新接收端的同名分支。适用于中央和非中央工作流。

It should only be:

它应该只是:

git config --global push.default current

(I am not aware of that setting for pull)

(我不知道拉的设置)

I would recommend:

我会推荐:

  • using the remote name instead of its url: origin
  • using a push with makes a tracking connection between your local and upstream branch:
  • 使用远程名称而不是其 url: origin
  • 使用 push with 在本地和上游分支之间建立跟踪连接:

So:

所以:

git push -u origin master
git pull origin

After that, a simple git pushwill be enough: see "Why do I need to explicitly push a new branch?" for more.

之后,一个简单的git push就足够了:参见“为什么我需要显式推送一个新分支?”了解更多信息。

回答by shanmugharaj

I tried this after push.

推后我试过这个。

git config --global pull.default current
git config --global push.default current

I tried this command after i made pull..

我在拉..后尝试了这个命令

Then when i pushed it it works.. Still i need to know the scene behind this ?

然后当我推动它时它起作用了..我还需要知道这背后的场景吗?

Really this is alone reason or ?

真的这是单独的原因还是?

If someone figure it please give a reply..

如果有人想出来请回复..