当前分支没有跟踪信息 [英] There is no tracking information for the current branch

查看:33
本文介绍了当前分支没有跟踪信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 github 的时间相对较短,而且我一直使用客户端来执行提交和拉取.昨天决定从 git bash 试一试,我成功创建了一个新的 repo 并提交了文件.

I've been using github from a relatively short period, and I've always used the client to perform commits and pulls. I decided to try it from the git bash yesterday, and I successfully created a new repo and committed files.

今天我从另一台计算机对存储库进行了更改,我已经提交了更改,现在我回到家并执行了 git pull 来更新我的本地版本,我得到了这个:

Today I did changes to the repository from another computer, I've committed the changes and now I'm back home and performed a git pull to update my local version and I get this:

There is no tracking information for the current branch.
    Please specify which branch you want to merge with.
    See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream develop origin/<branch>

这个 repo 的唯一贡献者是我,并且没有分支(只有一个 master).我在 Windows 上,我已经从 git bash 执行了拉取:

the only contributor to this repo is me and there are no branches (just a master). I'm on windows and I've performed the pull from git bash:

git 状态:

$ git status
# On branch master
nothing to commit, working directory clean

git 分支:

$ git branch
* master

我做错了什么?

推荐答案

您可以指定要拉取的分支:

You could specify what branch you want to pull:

git pull origin master

或者您可以设置它,以便您的本地 master 分支将 github master 分支作为上游跟踪:

Or you could set it up so that your local master branch tracks github master branch as an upstream:

git branch --set-upstream-to=origin/master master
git pull

当您克隆存储库(仅适用于默认分支)时,会自动为您设置此分支跟踪,但是如果您将远程添加到现有存储库,您必须自己设置跟踪.谢天谢地,git 给出的建议让你很容易记住该怎么做.

This branch tracking is set up for you automatically when you clone a repository (for the default branch only), but if you add a remote to an existing repository you have to set up the tracking yourself. Thankfully, the advice given by git makes that pretty easy to remember how to do.

这篇关于当前分支没有跟踪信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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