git pull error无法找到远程ref master

时间:2015-01-09 10:43:06

标签: git

我在服务器上创建了一个带有http访问权限的裸git存储库。在客户端我使用:

git init
git clone <URL>
touch 2.txt
git commit
git remote add origin <URL>
git push origin master

所有这些命令都可以正常工作。然后我想看看我的存储库是否有“2.txt” 我使用其他机器:

git init
git clone <URL>
git remote add origin <URL>
git pull origin master 

我得到了:

Could't find remote ref master
Unexpected end of command stream

我尝试了其他变体:

git pull

我得到了:

Your configuration specifies to merge with the ref 'master' 
from the remote, but no such ref was fetched

我认为,问题是我在服务器上没有任何分支。我试图在服务器上创建分支主服务器,但没有(mb coz是裸存储库) 我使用该指南创建对存储库的http访问: https://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt 我完成了步骤1-2,然后开始没有指导就完成了。 我想我错过了一些东西而且我最初的推动是错误的,因为它没有创建一个分支,但我不知道,该怎么做。 我是git的新手,我真的希望你能帮助我。

2 个答案:

答案 0 :(得分:0)

从第二台机器运行以下命令

git clone "your git-URL"

您将拥有2.txt文件的git repo。

答案 1 :(得分:0)

你是对的,你的遥控器没有分支'主'

当您开始处理新的仓库时,请确保您拥有主分支。您可以使用

执行此操作
git checkout -b master

在您现有的仓库中执行此操作并再次推送。然后它应按预期克隆。

相关问题