Git ! [被拒绝]主控->;新的最新分支上的master(非快进)

Git ! [被拒绝]主控->;新的最新分支上的master(非快进),git,github,git-push,git-pull,fast-forward,Git,Github,Git Push,Git Pull,Fast Forward,在我的回购中,我有一个master分支和一个new分支 我已经在new上工作了一段时间,在进行提交和推送的同时。我现在决定将其分支为new,称之为newst。所以我做了 git checkout -b "newest" 分支已成功创建。我添加了一个文件,并开始处理它。我做了几次改变 但是,当我尝试将此新分支及其更改推送到origin时,出现以下错误: C:\wamp\www\myproj>git push origin To https://github.com/Imray/Proj.g

在我的回购中,我有一个
master
分支和一个
new
分支

我已经在
new
上工作了一段时间,在进行提交和推送的同时。我现在决定将其分支为
new
,称之为
newst
。所以我做了

git checkout -b "newest"
分支已成功创建。我添加了一个文件,并开始处理它。我做了几次改变

但是,当我尝试将此新分支及其更改推送到
origin
时,出现以下错误:

C:\wamp\www\myproj>git push origin
To https://github.com/Imray/Proj.git
 ! [rejected]        master -> master (non-fast-forward)
 ! [rejected]        new -> new (non-fast-forward)
error: failed to push some refs to 'https://github.com/Imray/Proj.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 
因此,按照说明中的说明,我尝试了git pull,但后来我得到了:

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-to=origin/<branch> newest
当前分支没有跟踪信息。
请指定要与哪个分支合并。
有关详细信息,请参见git pull(1)
吉特拉力
如果您希望为此分支设置跟踪信息,可以通过以下方式进行设置:
git分支——将上游设置为=原点/最新
我卡住了


如何将新分支和更改推送到
github

检查您的
git config push.default
。它可能在“
matching
”上,因为它试图推送所有现有分支。
这就是问题所在

我建议将其设置为“
simple
”,以便只推送当前分支

也就是说,要推送分支,您需要(第一次推送)设置一个

对于以前从未推动过的分支:

git push -u origin newest
对于不存在于上的分支:

然后是一个
git签出主机;git pull将
工作。

尝试以下方法:

  • git pull--重新设置分支的主/名称的基础
希望能有帮助

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