This seems like a popular error for different causes.
I\'ve got a simple bare git repo called \"kiflea.git\", I clone it like this:
git clone git://k
There's definitely something wrong with your remote repository. You might be able to fix it by making a new clone of the repository. Also pushing a new commit to the master branch might work too.
I seemed to fix it with:
git checkout -b master
git push
This created the default master, and then I could checkout my other branches
Even though this error was displayed - my project was still connected to the corresponding repository - I ran the git branch
command and saw the appropriate branches - then I ran git checkout *branchname
and BOOM - all was well.
Yes this is related to your git clone trying to checkout a branch different than master. Just do this
git clone user@git-server:project_name.git -b branch_name /some/folder
This will help you clone the exact branch via its branch name.
In my case the repo was empty.
git checkout --orphan master
git add some_file
git commit -m 'init'
git push origin master
If there is no master branch actually available, check the following; If there is a file named 'packed-refs' inside the '.git' folder, open it and you could find all references listed.
Something like below;
# pack-refs with: peeled fully-peeled
e7cc58650190bd28599d81917f1706445d3c6d8b refs/tags/afw-test-harness-1.5
^cfae4f034e82591afdf4e5ed72279297d0eee618
6afe1bcfa4bd74de8e0c8f64d024e1cc289206df refs/tags/afw-test-harness-2.1
^c32f7fa495d4b44652f46c065fcd19c3acd237a6
72f2e4284dfbf27c82967da096c6664646bbdd19 refs/tags/android-1.6_r1
^50992e805e758e2231f28ec2127b57a1a9fd0ddc
0cbd528cad1cee9556098b62add993fc3b5dcc33 refs/tags/android-1.6_r1.1
Then use;
git checkout refs/tags/xxxx
Or
git checkout 'HASH value'
to checkout the required version. Thank you.