Mixopteryx
Mixopteryx

Reputation: 1148

Git fetch does not download remote branches

I cannot get Git to fetch new branches on the remote. git remote show will not show that any branch other than master exists, but git ls-remote proves that they exist.

Example: git ls-remote shows that the branch homodyne_process exist-

$ git ls-remote origin
b935ee960a588144d3df0f08a82b81ea705c7543        HEAD
f11bd3ac9c2345a12edb9d49cd5bd027616b2226        refs/heads/homodyne_process
b935ee960a588144d3df0f08a82b81ea705c7543        refs/heads/master

Fetch updates and show remote branches

$ git fetch
$ git remote show origin
* remote origin
  Fetch URL: [email protected]:***
  Push  URL: [email protected]:***
  HEAD branch: master
  Remote branch:
    master tracked
  Local branches configured for 'git pull':
    master        merges with remote master
  Local refs configured for 'git push':
    homodyne_process pushes to homodyne_process (fast-forwardable)
    master           pushes to master           (up to date)
$ git branch -r
  origin/master

I managed to get the homodyne_process pushes (...) line after running

git pull origin homodyne_process:homodyne_process

but it still won't show that the remote branch does exist. Why does this happen?

I have also tried any git fetch origin homodyne_process and lots of combinations, but the branch origin/homodyne_process will not appear.

I am working on windows and the repo is hosted via gitolite.

(I have removed some other branches from the output, for brevity. )

Upvotes: 13

Views: 12661

Answers (1)

Mixopteryx
Mixopteryx

Reputation: 1148

This answer solved my question: https://stackoverflow.com/a/25941875/1982894.

Basically I needed to run

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"

This sets git to fetch all remote branches and not just master. The original configuration was:

$ git config --get remote.origin.fetch
+refs/heads/master:refs/remotes/origin/master

Upvotes: 23

Related Questions