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 的新手,我真的希望你能帮助我。

在第二台计算机上,您只需运行以下命令

git clone "your git-URL"

你将拥有包含 2.txt 文件的 git 存储库。

你是对的,你的遥控器没有分支"master"

开始处理新存储库时,请确保具有主分支。你可以用

git checkout -b master

在现有存储库中执行此操作,然后再次推送。然后它应该按预期克隆。

最新更新