git Atlassian SourceTree 不显示远程分支?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27356015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:43:57  来源:igfitidea点击:

Atlassian SourceTree does not show remote branches?

gitatlassian-sourcetree

提问by u123

I am running SourceTree 1.6.11 on windows. I have cloned a Git repository but it does not show my remote branches:

我在 Windows 上运行 SourceTree 1.6.11。我已经克隆了一个 Git 存储库,但它没有显示我的远程分支:

enter image description here

在此处输入图片说明

Does SourceTree only show local branches?

SourceTree 是否只显示本地分支?

It shows all the tags though.

虽然它显示了所有标签。

回答by ellcub

I found this to checkout a remote branch:

我发现这是为了检查远程分支:

Repository > Checkout > Checkout New Branch > Checkout remote branch [select remote branch to checkout]

Repository > Checkout > Checkout New Branch > Checkout remote branch [select remote branch to checkout]

The branch I selected is now shown in the menu on the left under branches, (although still not in the branches dropdown box along the top)

我选择的分支现在显示在分支下左侧的菜单中,(虽然仍然不在顶部的分支下拉框中)

Hope this helps.

希望这可以帮助。

回答by David Bridge

This is an old post but I thought as I got here, others may too I had this issue in 1.6.2 Source tree (in Oct 2015) and my new remote made on another machine 5 days ago was not showing up in Source Tree on my work machine. I can see my remote branch with command line and in BitBucket web site but not in SourceTree.

这是一篇旧帖子,但我认为当我到达这里时,其他人也可能在 1.6.2 源树(2015 年 10 月)中遇到此问题,而我 5 天前在另一台机器上制作的新遥控器没有出现在源树中我的工作机器。我可以在命令行和 BitBucket 网站中看到我的远程分支,但在 SourceTree 中看不到。

Anyway, after ten minutes of doing nothing my remote branch showed up.

无论如何,十分钟后我的远程分支出现了。

I then found in options that there is a setting for refreshing remotes which not surprisingly was set to 10 minute intervals.

然后我在选项中发现有一个刷新遥控器的设置,这并不奇怪,它被设置为 10 分钟的间隔。

On top of this it is possible to refresh immediately with ALT+SHIFT+R

在此之上,可以立即刷新ALT+ SHIFT+R

Hope this helps someone.

希望这可以帮助某人。

Dave

戴夫

回答by Eric McCormick

What wound up working for me, after some trial and error, was to:

经过一些反复试验,最终对我有用的是:

  • copy the path of my remote
  • remove the remote from my repo settings
  • let my project refresh in SourceTree
  • add the remote back, in repo settings
  • perform a Fetch
  • 复制我的遥控器的路径
  • 从我的回购设置中删除遥控器
  • 让我的项目在 SourceTree 中刷新
  • 在回购设置中添加遥控器
  • 执行提取

The Fetch alone didn't seem to do the trick, in and of itself, for each repository I experienced the issue in (it happened in a small handful, and a Fetch alone did work for some).

对于我遇到问题的每个存储库,单独的 Fetch 似乎并没有解决问题(它发生在少数几个,而单独的 Fetch 确实对一些有用)。

Expanded info:

扩展信息:

What seems to be at issue here is how the local repository was tracking the remote. For those that a simple Fetch did notresolve the issue, running git branch -rin the repository yielded nothing. After successfully being able to view them, I confirmed the output of git branch -routput the HEADalong with masterand developbranches for my remote, as I expected.

这里似乎有问题的是本地存储库如何跟踪远程存储库。对于那些简单的获取并没有解决问题,运行git branch -r在仓库中得到什么。在成功查看它们后,我确认了输出HEADgit branch -r输出以及我的遥控器的masterdevelop分支,正如我预期的那样。

回答by jbooker

The solution for me was simple. Simply use the command line, and execute

对我来说,解决方案很简单。只需使用命令行,然后执行

git branch -r

and

git branch -a

to make sure you have all the remote branches locally, then checkout each branch which is NOT showing in sourcetree. After you check it out, it will display in sourcetree.

确保您在本地拥有所有远程分支,然后检查未在 sourcetree 中显示的每个分支。签出后,它将显示在源树中。

For instance, after executing

例如,执行后

git checkout develop

your develop branch will display in sourcetree.

您的开发分支将显示在源树中。

回答by flyx

SourceTree does show remote branches. It seems like your remote repository only has a branch master. Compare the output of git branch -r, which lists all remote branches. Try git fetchif your remote copy is out of sync.

SourceTree 确实显示远程分支。您的远程存储库似乎只有一个 branch master。比较 的输出git branch -r,其中列出了所有远程分支。git fetch如果您的远程副本不同步,请尝试。

回答by smp7d

(This probably is not your issue but it is easy to end up here with certain search queries.)

(这可能不是您的问题,但很容易以某些搜索查询结束。)

Make sure you perform a fetchon the remote repo. This may take care of it.

确保fetch在远程仓库上执行 a 。这可能会照顾它。

回答by jan2705170

I ran into this and none of the solutions here worked for me. What did work was in my SourceTree repository, press the Settings button to get the Repository Settings dialog. Then press the Edit Config File button and open the config file. Then changed the fetch line under [remote "origin"] to this, saved the file, fetched and the remote branches then showed up. Before:

我遇到了这个问题,这里没有一个解决方案对我有用。在我的 SourceTree 存储库中起作用的是什么,按“设置”按钮以获取“存储库设置”对话框。然后按编辑配置文件按钮并打开配置文件。然后将 [remote "origin"] 下的提取行更改为此,保存文件,提取并显示远程分支。前:

fetch = +refs/heads/master:refs/remotes/origin/master

After:

后:

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

回答by Madhawa Priyashantha

I had the same issue .refresh didn't work.so i manually fetch from the remote

我遇到了同样的问题 .refresh 不起作用。所以我手动从远程获取

Just run this command and restart sourcetree

只需运行此命令并重新启动 sourcetree

git fetch --all

回答by ryan r

I had this issue and it turns out the repo I was attempting to push to was not assigned to the team I was given rights to work as a part of. My admin moved the repo to our team and the problem was fixed.

我遇到了这个问题,结果我试图推送的 repo 没有分配给我有权工作的团队。我的管理员将 repo 移到了我们的团队,问题得到了解决。

回答by Nick Gorman

I tried a few of the above examples with no luck so here is what I did. In BitBucket, go to the branch you want to check out and press the beautiful blue "Checkout in SourceTree" button.

我尝试了上面的一些例子但没有运气,所以这就是我所做的。在 BitBucket 中,转到要签出的分支,然后按漂亮的蓝色“Checkout in SourceTree”按钮。

Next I went to SourceTree and instead of clicking Branches, which one would think being a newbie, click remotes on the left side. Open up your tree views until you find the branch you want to access and double click. A dialog should pop up to create a new branch, Go ahead and press ok. Your BitBucket branch should now be in your local and be showing in the Branch side menu.

接下来,我转到 SourceTree,而不是单击分支(人们认为是新手),而是单击左侧的遥控器。打开树视图,直到找到要访问的分支并双击。应该弹出一个对话框来创建一个新分支,继续并按确定。您的 BitBucket 分支现在应该在您的本地并显示在 Branch 侧边菜单中。

If this is completely wrong or the incredibly slow way let me know but it worked when all else didn't.

如果这是完全错误的或令人难以置信的缓慢方式,请告诉我,但是当其他一切都没有时,它会起作用。