Git 推送错误:未能将一些引用推送到?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46560963/
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-19 12:55:13  来源:igfitidea点击:

Git Push Error: failed to push some refs to?

gitgithub

提问by

I am trying to git push from my local repo (TEST) to remote branch (TEST-tapariak) using following command:

我正在尝试使用以下命令从我的本地存储库 (TEST) git push 到远程分支 (TEST-tapariak):

git push origin TEST:TEST-tapariak

I am getting following error:

我收到以下错误:

To ssh://git.example.com:2222/pkg/PARISService
 ! [rejected]        TEST -> TEST-tapariak (non-fast-forward)
error: failed to push some refs to 'ssh://git.example.com:2222/pkg/PARISService'
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.

I saw similar questionand did git pull --rebase, git pull --rebase origin TEST, and git pull --rebase origin TEST-tapariak but didn't work for me.

我看到了类似的问题,并执行了 git pull --rebase、git pull --rebase origin TEST 和 git pull --rebase origin TEST-tapariak 但对我不起作用。

Can anyone guide me how to resolve this?

谁能指导我如何解决这个问题?

回答by Maijied Hasan Shuvo

use this command to upload full project forcefully,

使用此命令强制上传完整项目,

git push -u origin master -f

回答by Sajib Khan

hint: (e.g. 'git pull ...') before pushing again.

提示:(例如'git pull ...')在再次推送之前。

Pull remote TEST-tapariakbranch into local TESTbranch first, then Push.

先拉远程TEST-tapariak分支到本地TEST分支,再推送。

$ git pull origin TEST-tapariak
$ git push origin TEST:TEST-tapariak 

回答by prisoner_of_azkaban

Go to master do git pullthen comeback to your branch and do: git rebase -i masterIf there are any conflicts:

转到 master dogit pull然后回到你的分支并执行:git rebase -i master如果有任何冲突:

  1. Resolve them
  2. Do git add --all
  3. Then git rebase --continue
  1. 解决它们
  2. git add --all
  3. 然后 git rebase --continue

Finally do git push

最后做 git push

回答by Sheikh Hanif

Can you do the following:

你能不能做到以下几点:

git pull --rebase origin TEST-tapariak

And finally,

最后,

git push origin TEST:TEST-tapariak