Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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.

like image 1000
Shai Reznik - HiRez.io Avatar asked Jun 20 '13 09:06

Shai Reznik - HiRez.io


1 Answers

  • 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)
like image 97
Jan Krüger Avatar answered Sep 18 '22 17:09

Jan Krüger