Reputation: 2620
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.
Upvotes: 38
Views: 18259
Reputation: 1335
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
Upvotes: 13
Reputation: 1378
For anybody getting here via google while having the same problem (by 'the same' I mean the same error message not the same cause) with 'git svn' rather than just 'git':
Removing the -t option might help as explained in: git-svn: Cannot setup tracking information; starting point is not a branch
Upvotes: 7
Reputation: 1251
Probably your origin remote is set up to fetch only certain branches. A simple
git remote set-branches --add origin master
will fix it.
Upvotes: 77