Git clone: Warning: Remote head refers to nonexistent ref, unable to checkout

Source: Internet
Author: User

The following warning occurs during git clone:

 

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

The reason is that the/. Git/refs/Heads file in the. Git directory does not contain the file pointed to by the head under the. Git directory. You can use the GIT show-ref command to view other files.

eadc2c7d702724e788d8c6bcdb638b6b228e6ab5 refs/heads/another_branch

You can use git branch-M anoter_branch master in this directory to change another_branch to master, so that this warning will not occur during re-cloning.

 

You can also view all Sha values in the refs directory through git rev-Parse -- all.

 

You can use git rev-Parse to check the Sha value of a certain branch tag. Is there a way to know the Sha value and its corresponding branch and tag? It seems impossible?

 

Note: The cause of this problem is that a local git project is copied and then cloned based on this project, because there is only my_topic locally, only one my_topic branch is cloned, and the remote branch of the server will not be cloned here.

 

When using the local bionic clone

Git clone bionic local_bionic

Then

Git remote show origin
* Remote origin
Fetch URL:/home/hebo/work/test/bionic
Push URL:/home/hebo/work/test/bionic
Head Branch (Remote head is ambiguous, may be one of the following ):
Froyo-prod-bb
My_topic
Remote branches:
Froyo-prod-BB tracked
My_topic tracked
Local branch configured for 'git pull ':
Froyo-prod-BB merges with remote froyo-prod-bb
Local ref configured for 'git push ':
Froyo-prod-BB pushes to Froyo-prod-BB (up to date)
In this case, the remote branch is the cloned object, while the remote branch of bionic itself cannot be retained, and the cloned warehouse, the current branch, what is the branch of clone in local checkout.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.