Egit拒绝不快 [英] Egit rejected non-fast-forward

查看:100
本文介绍了Egit拒绝不快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在推送到github仓库时收到此消息。你能告诉我一步一步的程序来解决它吗?我只推了一次,成功了。但是,当我更新一个项目并试图推动我的第二个提交时,它显示主人拒绝不快,不允许我推。请解释这个程序。

解决方案

我有同样的问题,我能够解决它。 afk5min是对的,问题是您从远程存储库上更改了代码之后的分支。根据标准git做法( http://git-scm.com) / book / en / Git-Basics-Working-with-Remotes ),您需要(现在)将远程存储库中的这些更改合并到本地更改中,然后才能提交。这是有道理的,这迫使你采取其他的改变并将它们合并到您的代码中,确保您的代码继续适用于其他更改。



无论如何,on


  1. 配置fetch以获取您最初从中提取的分支。


  2. 获取远程分支。


  3. 将远程分支合并到本地分支机构。


  4. 提交本地回购中的(合并)更改。


  5. 将更改推送到远程回购。 p>


详细...


  1. 在eclipse中,打开视图Git Repositories。


  2. 确保您看到本地存储库,并可以将远程存储库视为子文件夹。在我的版本中,它被称为Remotes,然后我可以看到该远程项目。


  3. 寻找指向左边的绿色箭头,这是'抓取'箭头。右键单击并选择配置提取。


  4. 您应该看到URI,确保它指向远程存储库。


  5. 查看弹出窗口的参考映射部分。我是空的这将指示您要获取哪些远程引用。单击添加。


  6. 键入从远程存储库获取的分支名称。我是主人(btw,这里的一个下拉菜单将会很棒!!,现在你必须输入)。继续浏览弹出窗口,最后点击完成。


  7. 点击保存并提取。这将获取远程参考。


  8. 查看本地存储库中的分支文件夹。您现在应该在远程文件夹中看到远程分支。再次,我看到'master'。


  9. 右键单击分支的本地文件夹中的本地分支,该文件夹名为主 。选择合并,然后选择远程分支,其名称为origin / master。


  10. 通过合并处理。


  11. 提交对本地存储库的更改。


  12. 将更改推送到远程存储库。


  13. 去享用美味的饮料,祝贺你自己。休息一天。



I am getting this message while pushing to github repository. Can you tell me step by step procedure to fix it? I pushed only once and it was successful. But, when I updated a project and tried to push my second commit, it shows "master rejected non-fast-forward" and does not allow me to push. Please explain the procedure.

解决方案

I had this same problem and I was able to fix it. afk5min was right, the problem is the branch that you pulled code from has since changed on the remote repository. Per the standard git practices(http://git-scm.com/book/en/Git-Basics-Working-with-Remotes), you need to (now) merge those changes at the remote repository into your local changes before you can commit. This makes sense, this forces you to take other's changes and merge them into your code, ensuring that your code continues to function with the other changes in place.

Anyway, on to the steps.

  1. Configure the 'fetch' to fetch the branch you originally pulled from.

  2. Fetch the remote branch.

  3. Merge that remote branch onto your local branch.

  4. Commit the (merge) change in your local repo.

  5. Push the change to the remote repo.

In detail...

  1. In eclipse, open the view 'Git Repositories'.

  2. Ensure you see your local repository and can see the remote repository as a subfolder. In my version, it's called Remotes, and then I can see the remote project within that.

  3. Look for the green arrow pointing to the left, this is the 'fetch' arrow. Right click and select 'Configure Fetch'.

  4. You should see the URI, ensure that it points to the remote repository.

  5. Look in the ref mappings section of the pop-up. Mine was empty. This will indicate which remote references you want to fetch. Click 'Add'.

  6. Type in the branch name you need to fetch from the remote repository. Mine was 'master' (btw, a dropdown here would be great!!, for now, you have to type it). Continue through the pop-up, eventually clicking 'Finish'.

  7. Click 'Save and Fetch'. This will fetch that remote reference.

  8. Look in the 'Branches' folder of your local repository. You should now see that remote branch in the remote folder. Again, I see 'master'.

  9. Right-Click on the local branch in the 'Local' folder of 'Branches', which is named 'master'. Select 'Merge', and then select the remote branch, which is named 'origin/master'.

  10. Process through the merge.

  11. Commit any changes to your local repository.

  12. Push your changes to the remote repository.

  13. Go have a tasty beverage, congratulating yourself. Take the rest of the day off.

这篇关于Egit拒绝不快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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