Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does git not recognize "origin/master" as a valid object name?

Tags:

git

~/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

like image 912
Rose Perrone Avatar asked Feb 05 '13 22:02

Rose Perrone


3 Answers

$ 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

like image 88
Zombo Avatar answered Oct 16 '22 02:10

Zombo


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.

like image 31
TachyonVortex Avatar answered Oct 16 '22 02:10

TachyonVortex


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.

like image 34
Bleeding Fingers Avatar answered Oct 16 '22 03:10

Bleeding Fingers