Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot setup tracking information; starting point 'origin/master' is not a branch

Tags:

git

Can someone explain why this isn't working?

➜  workspace git:(REL-BRANCH-1.0.1d) ✗ git branch -a   REL-BRANCH-1.0.1c * REL-BRANCH-1.0.1d   remotes/origin/REL-BRANCH-1.0.1c   remotes/origin/master ➜  workspace git:(REL-BRANCH-1.0.1d) ✗ git checkout -t origin/master  fatal: Cannot setup tracking information; starting point 'origin/master' is not a branch. ➜  workspace git:(REL-BRANCH-1.0.1d) ✗ git checkout -t remotes/origin/master fatal: Cannot setup tracking information; starting point 'remotes/origin/master' is not a branch. 
like image 364
user2684301 Avatar asked Mar 17 '14 03:03

user2684301


2 Answers

Probably your origin remote is set up to fetch only certain branches. A simple

git remote set-branches --add origin master 

will fix it.

like image 124
ansiwen Avatar answered Sep 17 '22 15:09

ansiwen


It is possible that your repo contains config that asks fetch command to retrieve only some specific branch(es) instead of just all of them. You can check the configuration you have using

git config --local --get-all remote.origin.fetch 

It can return lines like +refs/heads/*:refs/remotes/origin/*, +refs/heads/master:refs/remotes/origin/master or +refs/heads/AnyOtherBranch:refs/remotes/origin/AnyOtherBranch. The first config string means that it fetches all the branches. The second and third are examples of fetch config only for specific branches. If you don't have config line with asterisk then you can use either

# Reset "remote.origin.fetch" to deal with all branches git remote set-branches origin '*' 

or

# Append new config line for specific branch git remote set-branches --add origin AnyOtherBranch 
like image 32
Victor Yarema Avatar answered Sep 20 '22 15:09

Victor Yarema