warning: remote HEAD refers to nonexistent ref, unable to checkout.

问题:git clone无法获取代码

~/Desktop$ git clone xxx
Cloning into 'xxx'...
remote: Counting objects: 670, done
remote: Finding sources: 100% (670/670)
remote: Total 670 (delta 312), reused 666 (delta 312)
Receiving objects: 100% (670/670), 39.90 MiB | 11.20 MiB/s, done.
Resolving deltas: 100% (312/312), done.
Checking connectivity... done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

分析:$git branch -a
remotes/origin/branch-name
发现没有master而有其它分支branch-name,由于git clone默认获取master分支code,故需要在pull时指定分支branch-name

解决办法:

git pull origin branch-name

 


版权声明:本文为jzp12原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。