无法从另一台计算机访问git分支 [英] cannot access a git branch from a different computer

查看:137
本文介绍了无法从另一台计算机访问git分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我看不到另一台计算机上的分支.我跑

Basically i cannot see a branch on a different computer. I run

git branch -a

在家用计算机上,我会得到

and on home computer I get

C:\learn ror\sample_app [filling-in-layout]> git branch -a
* filling-in-layout
  master
  static-pages
  remotes/origin/filling-in-layout
  remotes/origin/master
  remotes/origin/static-pages

在工作电脑上,除填充布局"分支(本地和远程)外,我得到的结果几乎相同.

On the work pc I get almost the same result, except the "filling-in-layout" branches(local and remote).

我该怎么办?

推荐答案

要共享分支,您需要在创建分支的计算机上推送分支,并在其他计算机上设置远程跟踪分支:

To share branches, you need to push your branches on the machines where they're created, and setup remote tracking branches on the other machines:

在具有分支机构的计算机上尝试以下操作:

Try this, on the machine that has the branch:

git push -u origin <branch name>

,而在没有的机器上:

git fetch
git checkout <branch name>

如果您尝试检出仅存在于遥控器上的分支,Git将自动设置一个名为<branch name>的远程跟踪分支.

Git will automatically set up a remote tracking branch named <branch name> if you try to check out a branch that only exists on a remote.

这篇关于无法从另一台计算机访问git分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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