git 尝试推送到服务器时在 netbeans 中获取 REJECTED_NONFASTFORWARD

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

Getting REJECTED_NONFASTFORWARD in netbeans when trying to push to server

gitnetbeans

提问by user61629

I am a new git user.

我是一个新的 git 用户。

I have a repository on bitbucket that I would like to import into a .git folder I have created on my live shared host web server ( where I have git installed ). I can give commands via SSH. I am following the instructions in http://joemaller.com/990/a-web-focused-git-workflow/

我在 bitbucket 上有一个存储库,我想将其导入到我在实时共享主机 Web 服务器上创建的 .git 文件夹中(我安装了 git)。我可以通过 SSH 发出命令。我正在按照http://joemaller.com/990/a-web-focused-git-workflow/ 中的说明进行操作

I have been able to set up the 2 repos on the server as described in the article. I also have the post update and post commit hooks in place. I am trying to test the system by pushing an update to the server. I am using netbeans 7.3 beta git support. However when give the command:

我已经能够按照文章中的描述在服务器上设置 2 个存储库。我也有 post update 和 post commit hooks。我正在尝试通过向服务器推送更新来测试系统。我正在使用 netbeans 7.3 beta git 支持。但是当给出命令时:

push ( in netbeans ) to ssh://****.com/home/******/site_hub.git

The output is:

输出是:

==[IDE]== Nov 19, 2012 10:28:15 PM Pushing
git push ssh://***.com/home/***/site_hub.git +refs/heads/master:refs/heads/master
Repository Updates
Branch : master
Old Id : 0121897bdd7cf3caad9e18717fc27a7a08***
New Id : 837c194c70fb41dc7de3be7841c946ca***
Result : REJECTED_NONFASTFORWARD

Local Repository Updates
No update
==[IDE]== Nov 19, 2012 10:28:18 PM Pushing finished.

How can I fix this?

我怎样才能解决这个问题?

回答by mgarciaisaia

A non-fastforward push means the branch your are trying to push to diverged from the point your current branch is. In other words, there are new commits in your remote that you have to merge with to be able to push.

非快进推送意味着您尝试推送的分支与当前分支的点不同。换句话说,您必须合并远程中的新提交才能推送。

To achieve this, you can git pullin order to merge both branches, and then push the result, or you can do a git fetchand then a git rebase origin/master(or whatever names you put to your remote and HEAD branch) so your commits are applied on top of the remote branch. Then you can push the result, and that would be a fast-forward.

为了实现这一点,您可以git pull合并两个分支,然后推送结果,或者您可以执行 agit fetch和 a git rebase origin/master(或您放置在远程和 HEAD 分支的任何名称),以便您的提交应用在远程之上分支。然后你可以推送结果,这将是一个快进。

回答by Travis

In my case doing the following seemed to do the trick

在我的情况下,执行以下操作似乎可以解决问题

git checkout master

git pull

In my case when I switched back to master I got this

就我而言,当我切换回 master 时,我得到了这个

Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded. (use "git pull" to update your local branch)

您的分支落后于 'origin/master' 8 个提交,并且可以快进。(使用“git pull”来更新你的本地分支)

I'm thinking this is probably the same ish as mgarciaisaia answered but I wanted to post in case it might help someone.

我想这可能与 mgarciaisaia 回答的一样,但我想发布以防它可能对某人有所帮助。

回答by larry mintz

Here is my report for NONFASTFORWARD problem

这是我关于 NONFASTFORWARD 问题的报告

Local Repository Updates ==[IDE]== 3-Dec-2017 11:53:22 AM Pushing - Mycology Pro finished. ==[IDE]== 3-Dec-2017 11:54:19 AM Create Branch git branch --track Master_v2.0 master Branch created Name: Master_v2.0 From: master Id : 1dac54d97af9be9e2d4e78ed1550ed486d26a76f git show conflicts git checkout Master_v2.0 ==[IDE]== 3-Dec-2017 11:54:19 AM Create Branch finished. ==[IDE]== 3-Dec-2017 11:54:58 AM Fetching - Mycology Pro git remote -v setting up remote: origin git fetch https://[email protected]/larry-mintz/MycoForms.git+refs/heads/master:refs/remotes/origin/master No update ==[IDE]== 3-Dec-2017 11:54:59 AM Fetching - Mycology Pro finished. ==[IDE]== 3-Dec-2017 11:55:27 AM Pushing - Mycology Pro git branch git remote -v setting up remote: origin git submodule status git push https://[email protected]/larry-mintz/MycoForms.gitrefs/heads/master:refs/heads/master

本地存储库更新 ==[IDE]== 2017 年 12 月 3 日上午 11:53:22 推送 - Mycology Pro 完成。==[IDE]== 2017 年 12 月 3 日上午 11:54:19 创建分支 git branch --track Master_v2.0 master Branch created Name: Master_v2.0 From: master Id : 1dac54d97af9be9e2d4e78ed1550ed486d26a76f checkout Master_v2 ==[IDE]== 2017 年 12 月 3 日上午 11:54:19 创建分支完成。==[IDE]== 2017 年 12 月 3 日上午 11:54:58 获取 - Mycology Pro git remote -v 设置远程:origin git fetch https://[email protected]/larry-mintz/MycoForms .git+refs/heads/master:refs/remotes/origin/master 无更新 ==[IDE]== 2017 年 12 月 3 日上午 11:54:59 获取 - Mycology Pro 完成。==[IDE]== 2017 年 12 月 3 日上午 11:55:27 推送 - Mycology Pro git branch git remote -v 设置远程:origin git submodule status git pushhttps://[email protected]/larry-mintz/MycoForms.gitrefs/heads/master:refs/heads/master

Remote Repository Updates Branch Update : master Old Id : d3c98e3ac615861a1747759639f878ba8f235f38 New Id : 1dac54d97af9be9e2d4e78ed1550ed486d26a76f Result : REJECTED_NONFASTFORWARD

远程存储库更新分支更新:master 旧 Id:d3c98e3ac615861a1747759639f878ba8f235f38 新 Id:1dac54d97af9be9e2d4e78ed1550ed486d26a76fECTRWResult:REASTFOEDRWResult

I tried everything .In the end I did this:

我尝试了一切。最后我这样做了:

Remote Repository Updates Branch Add : Master_v2.0 Id : 1dac54d97af9be9e2d4e78ed1550ed486d26a76f Result : OK

远程存储库更新分支添加:Master_v2.0 Id:1dac54d97af9be9e2d4e78ed1550ed486d26a76f 结果:OK

Local Repository Updates Branch Add : origin/Master_v2.0 Id : 1dac54d97af9be9e2d4e78ed1550ed486d26a76f Result : NEW

本地存储库更新分支添加:origin/Master_v2.0 Id:1dac54d97af9be9e2d4e78ed1550ed486d26a76f 结果:新

==[IDE]== 3-Dec-2017 11:57:17 AM Setting Tracked Branch ==[IDE]== 3-Dec-2017 11:57:17 AM Pushing - Mycology Pro finished. git branch --set-upstream-to origin/Master_v2.0 Master_v2.0 Branch "Master_v2.0" marked to track branch "origin/Master_v2.0" ==[IDE]== 3-Dec-2017 11:57:17 AM Setting Tracked Branch finished.

==[IDE]== 2017 年 12 月 3 日上午 11:57:17 设置跟踪分支 ==[IDE]== 2017 年 12 月 3 日上午 11:57:17 推送 - Mycology Pro 完成。git branch --set-upstream-to origin/Master_v2.0 Master_v2.0 分支“Master_v2.0”标记为跟踪分支“origin/Master_v2.0”==[IDE]== 2017 年 12 月 3 日 11:57: 17 AM 设置跟踪分支完成。