无法看到远程分支,与.git / config的问题? [英] Can't see remote branch, problems with .git/config?

查看:98
本文介绍了无法看到远程分支,与.git / config的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我无法看到我的团队进入的新分支,我确信分支存在,因为我可以在Bitbucket的用户界面中看到它。



我感觉这可能是因为我的.git / config文件不正确。



目前我有这个...

  [remoteorigin] 
url = git@bitbucket.org:user / project.git
fetch = + refs /头/主:refs / remotes / origin / master
fetch = + refs / heads / testing:refs / remotes / origin / testing
fetch = + refs / heads / uat:refs / remotes / origin / uat
fetch = + refs / heads / release-1.9:refs / remotes / origin / release-1.9

我尝试了git remote update& git fetch origin,但都未能获得新的分支

我记得主演这个问题我看不到我的远程分支,并在旧笔记本电脑上将我的配置更改为如下所示:

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

我真的很想知道为什么我的配置文件处于当前状态的潜在原因......也许我没有在正确的地方创建分支



一般来说,在创建新分支时,我正在做类似于

  git checkout -b issue-1001 

然后下面分享我的分支

  git push origin issue-1001 


解决方案

fetch refspec你只能获取 er testing uat release-1.9 。因此,任何推到远程仓库的其他分公司都会被忽略,并且永远不会被带到您当地的仓库。您的笔记本电脑上的refspec:

  + refs / heads / *:refs / remotes / origin / * 

表示从远程存储库获取所有分支,所以任何新的分支都可以看到。

简单的说就是,如果你想看到新的分支,那么你需要使用一个像上面那样的refspec。



顺便说一句,你创建分支的方式看起来不错。 : - )

For some reason I can't see new branches that one my team has entered, I am 99% sure the branch exists as I can see it in Bitbucket's UI.

I have a feeling it may be because my .git/config file is not correct.

At the moment I have this...

[remote "origin"]
    url = git@bitbucket.org:user/project.git
    fetch = +refs/heads/master:refs/remotes/origin/master
    fetch = +refs/heads/testing:refs/remotes/origin/testing
    fetch = +refs/heads/uat:refs/remotes/origin/uat
    fetch = +refs/heads/release-1.9:refs/remotes/origin/release-1.9

I have tried "git remote update" & "git fetch origin" but both fail to get the new branch

I remember "starring" the issue here I can't see my remote branch, and changing my config to something like the following on an older laptop

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

I would really like to know the underlying reason as to why my config file is in it's current state...perhaps I am not creating branches in the correct way?

In general when creating new branches I am doing something like

git checkout -b issue-1001

And then the following to share my branch

git push origin issue-1001

解决方案

The fetch refspec you have in place is only fetching master, testing, uat, and release-1.9. As a result, any other branches pushed up to the remote repo, are ignored and are never brought to your local repo. The refspec on your laptop:

+refs/heads/*:refs/remotes/origin/*

says to fetch all branches from the remote repository, so any new branches would be visible to you.

The short form is that if you want to see the new branches, then you need to use a refspec like the one above.

BTW, the way you're creating branches looks fine. :-)

这篇关于无法看到远程分支,与.git / config的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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