git clone下载代码提示不存在HEAD指向的文件

|--question

  git clone 下载一个仓库出现一个警告,没有生成相关的代码

  warning: 远程 HEAD 指向一个不存在的引用,无法检出。
  warning: remote HEAD refers to nonexistent ref, unable to checkout.

|--solution

  .git目录下.git/refs/heads不存在HEAD指向的文件

    git branch -a 
    git checkout remotes/origin/Zoro

  此时,工程目录下有相关代码
    git branch
    提示
  (头指针分离于 origin/Zoro)

  git checkout -b remotes/origin/Zoro

  切换到一个新分支 'remotes/origin/Zoro'
* remotes/origin/Zoro

此时, 生成head

  git branch -m remotes/origin/Zoro master

  * master 切换到master分支

    git branch -a
  * master
    remotes/origin/Zoro
  attention:git help branch(指令名) 查看帮助

原文地址:https://www.cnblogs.com/xzpin/p/11074148.html