我在我的服务器上创建了一个带有http访问权限的纯粹git存储库。在我使用的客户端上:git pull error无法找到远程参考大师
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'之前运行'git init'。这实际上几乎肯定会让你陷入麻烦,因为你会得到“嵌套仓库”。 – Jubobs
我确定你的'git push origin master'失败了。 –
'git克隆'就够了。它会初始化,添加远程以及从远程拉。 –