我在寻找一个确定的答案,但没有找到任何相关的信息。我们正在使用远程Git仓库,在该仓库中推送不是主分支的分支。例如:
git checkout -b new_branch
git add --all .
git commit -m "changes"
git push remote new_branch
然而,当我们尝试从该裸远程仓库进行克隆时,会出现错误:
git clone /path/to/repo.git
warning: remote HEAD refers to nonexistent ref, unable to checkout.
我不确定为什么HEAD处于分离状态,没有指向new_branch上的最新提交。我们该如何克隆这个远程仓库?
remote
有主分支吗?也许你想要更改远程默认分支? - Tonygit branch -a
的输出会显示remotes/origin/HEAD
(或者远程名称)的信息吗? - chepner