Git获取不会下载远程分支 [英] Git fetch does not download remote branches

查看:168
本文介绍了Git获取不会下载远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让Git在远程获取新分支。 git remote show 不会显示master以外的任何分支,但 git ls-remote 证明它们存在。


$ b

示例: git ls-remote 显示分支homodyne_process存在 -

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

获取更新并显示远程分支机构

  $ git fetch 
$ git remote show origin
* remote origin
抓取网址:gitolite@git.uio.no:***
推送网址: gitolite@git.uio.no:***
HEAD分支:master
远程分支:
跟踪的主数
为'git pull'配置的本地分支:
master合并到远程主
为'git push'配置的本地引用:
homodyne_process推送到homodyne_process(快速转发)
主引导到master(最新)
$ git分支-r
或igin / master

我设法得到 homodyne_process pushes(...) 运行后的行

  git pull origin homodyne_process:homodyne_process 

但它仍然不会显示远程分支确实存在。为什么会发生这种情况?



我也尝试过任何 git fetch origin homodyne_process 和很多组合,但分支 origin / homodyne_process 不会出现。

我正在使用windows,并且通过gitolite托管回购站。



(为了简洁起见,我从输出中删除了一些其他分支。)

解决方案 div>

这个答案为我解决了我的问题 https://stackoverflow.com/a/25941875/1982894



基本上我需要运行

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

获取所有远程支线,而不仅仅是主人。原始配置是:

$ p $ g $ config $ get $ remote $ :refs / remotes / origin / master


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: gitolite@git.uio.no:***
  Push  URL: gitolite@git.uio.no:***
  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. )

解决方案

This answer solved my question for me 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 braches and not just master. The original configuration was:

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

这篇关于Git获取不会下载远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆