~/www> git branch --track live origin/master
fatal: Not a valid object name: 'origin/master'.
~/www> git remote
origin
~/www> git branch
* master
test_branch
working_branch
I also tried creating a tracking branch with:
git branch live
git branch --set-upstream live origin/master
but I got the same error
$ git branch -r
origin/1.x
origin/1.x@60
origin/1.x@63
origin/HEAD -> origin/master
origin/master
$ git branch --track live origin/blah
fatal: Not a valid object name: 'origin/blah'.
As has been suggested you can only track a remote if it has been added. Perhaps add the remote like this
$ git remote add upstream git://github.com/svnpenn/rtmpdump.git
$ git fetch upstream
Example
Your output from git remote
confirms that you've successfully added your origin
remote.
I expect the problem is that you haven't yet created the remote-tracking branch(es). If you do git branch -r
, it probably won't output anything. So origin/master
is not a valid object name because that remote-tracking branch doesn't exist yet.
The solution is to do git fetch origin
to create the remote-tracking branch(es). If you then do git branch -r
, you'll see origin/master
now exists.
I was encountering the very same problem. And it turned out that I didn't have write permission in the remote. And hence the error.
Make sure you have the write permissions at remote. Not have one is one of the causes of this particular error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With