I am trying the checkout a branch from a remote repository into a local branch, and receive the above error.
For those who want to direct me to: Why is it not a commit and a branch cannot be created from it?, then I already tried fetching, and even git fetch --all
To be precise, I cannot checkout any branch on the Github repository, that is not the main branch that I'm tracking, let's call it dev.
So, I can do the following:
git checkout origin/dev -b my_own_dev_env But I cannot checkout any other branch, not even
git checkout origin/master -b master And in this case I receive
"fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it"
Edit: When cloning to a new directory, I can perform all git operations as usual. So I would like to know what could go wrong in a local copy that prevents git commands from working properly?
git clone --single-branchoriginally?single_branchoption.--single-branch. If you didn't usegit clone --depthorgit clone --single-branch, you must have set it some other way. Set this back to normal, andgit fetchwill make `git checkout work again. See stackoverflow.com/q/17714159/1256452