Shai Reznik - HiRez.io
Shai Reznik - HiRez.io

Reputation: 8948

Can't track remote branch - doesn't recognize origin/develop

I have git 1.8.3 and a repo with 'master' and 'develop' branches.

From my local 'develop' branch, I'm trying to do the following command -

git branch -u origin/develop

and I get an error of

error: the requested upstream branch 'origin/develop' does not exist

When I check git branch -r I see only origin/master

I'm trying to find a way to make my system recognize that there is also a origin/develop and can't find any solution that works.

Upvotes: 17

Views: 16845

Answers (1)

Jan Krüger
Jan Krüger

Reputation: 18530

  • If the branch develop already exists in the remote repository, use git fetch to update your "remote-tracking branches" (local mirrors).
    • This requires that the fetch refspec is set correctly (in .git/config in the section for your remote); the default is fetch = +refs/heads/*:refs/remotes/<name of remote>/*. In some cases, configuration may be set up to fetch only one branch (specific branch name used instead of wildcard). It should be safe to change the configuration; this will allow fetching all branches.
  • If the branch doesn't exist yet in the remote repository, you can set up the association while pushing it for the first time: git push -u origin develop (that takes care of what you're trying to do with your command at the same time as it pushes the branch)

Upvotes: 31

Related Questions