您要求从远程 'origin' 拉取,但是未指定一个分支。因为这不是当前 分支默认的远程仓库,您必须在命令行中指定一个分支名。

来源:互联网 发布:windows蓝牙管理软件 编辑:程序博客网 时间:2024/05/30 23:51

我一直在使用github从相对较短的时间里,我一直用客户端执行提交和拉。我昨天从gitbash决定尝试它,我成功地创建了一个新的回购和提交文件。今天我做了更改存储库从另一台计算机,我承诺的改变,现在我回家,进行了更新我的本地版本,我得到:回购是我唯一因素和没有分支(硕士)。我在windows和拉从gitbash(http://prntscr.com/85picx)执行git状态:git分支:我做错了什么?

原文:

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.

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>

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 (http://prntscr.com/85picx)

git status:

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

git branch:

$ git branch* master

what am i doing wrong?

网友:好吧,一个怎么样?这表示什么呢?

(原文:Okay, how about a git remote -v? What does that say?)


解决方案:
您可以指定分支你想把什么:或者你可以设置它,这样你的地方作为上游主分支跟踪github主分支:这个分支跟踪为您自动设置当你克隆一个存储库(仅为默认分支),但如果你添加一个远程到现有存储库设置跟踪自己。谢天谢地,git的建议使得很容易记住如何去做。
原文:

You could specify what branch you want to pull:

git pull origin 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 mastergit pull

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.

网友:完美!它工作。所以发生了什么是没有“默认分支”默认“git拉”?这就是为什么有错误吗?

(原文:perfect! it worked. so what happened is there was no "default branch" for a default "git pull"? that's why there was the error?)

网友:1.9——set-upstream在git中已被弃用。x,显然。未来你想使用类似,假设你已经签出大师。如果不是,将工作。

(原文:--set-upstream is deprecated in git 1.9.x, apparently. Going forward you'd want to use something like git branch -u origin/master, assuming you've checked out master already. If not, git branch -u origin/master master will work.)

网友:@BartRead更新使用新的清晰的语法。(替代)

(原文:@BartRead updated it to use the new clearer --set-upstream-to= syntax. (which is the replacement for --set-upstream))

网友:谢谢!

(原文:Thanks for that!)

网友:这似乎是一个令人遗憾的状况——我们真的需要手动设置为每个分支?为什么我们不能设置原点是默认远程然后有推/拉默认分支具有相同名称的起源吗?这是如此困难吗?

(原文:this seems like a sorry state of affairs - do we really need to set this manually for every branch? Why can't we just set origin to be the default remote and then have every push/pull default to the branch on origin with the same name? is this so hard?)

0 0
原创粉丝点击