git fetch 无法获取远程分支?

昨天遇到的问题,远程仓库有6个分支,但是在本地使用 git fetch 之后,并不能获取到远程的分支信息,使用 git branch -a 也只能看到 master 分支(以及一个HEAD,指向master分支)折腾了一番之后发现是配置文件出了问题。 编辑 .git/config 文件,把 fetch 改成下面第二种形式,不要写死master。

[remote "origin"]
        url = https://github.com/xxx/project.git
        fetch = +refs/heads/master:refs/remotes/origin/master

[remote "origin"]
        url = https://github.com/xxx/project.git
        fetch = +refs/heads/*:refs/remotes/origin/*

问题来源: https://www.jianshu.com/p/c0c1a9e14fbb

eclipse中可以在git视图下,右击项目Properties修改

转载于:https://my.oschina.net/u/1440088/blog/3025552

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐