Hi,
I keep getting the error `fatal: Not a valid object name master` on commands that use git. Even when fetching all refs in the same step or just before the command.
Any ideas? :)
The git error "fatal: Not a valid object name master" shows that the local repository has no branch named "master". That branch is important as it is the main branch name for git and some git commands depend on it, e.g. the one that fails in your case.
This is despite you fetched all the remote references (incl. the branches and especially the remote master branch) because all remote branches are prefixed with remote/<remote-name>/<remote-branch-name> in the local repository.
To fetch the remote master branch as the local master branch to create it locally as well, use git fetch:
git fetch origin master:master
Do this before the git command that previously failed and it should work.
References:
Thanks a lot @ktomk !
That's indeed the proper answer. I used to try to fetch references using the remote syntax instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.