development

Egit이 비 빨리 감기를 거부했습니다.

big-blog 2020. 9. 17. 08:27
반응형

Egit이 비 빨리 감기를 거부했습니다.


github 저장소로 푸시하는 동안이 메시지가 표시됩니다. 문제를 해결하기위한 단계별 절차를 알려 주시겠습니까? 한 번만 밀었 고 성공했습니다. 그러나 프로젝트를 업데이트하고 두 번째 커밋을 푸시하려고하면 "마스터가 빨리 감기를 거부했습니다"라는 메시지가 표시되고 푸시가 허용되지 않습니다. 절차를 설명하십시오.


나는 똑같은 문제가 있었고 그것을 고칠 수있었습니다. afk5min이 옳았습니다. 문제는 코드를 가져온 지점이 원격 저장소에서 변경되었다는 것입니다. 표준 git 관행 ( http://git-scm.com/book/en/Git-Basics-Working-with-Remotes )에 따라 (이제) 원격 저장소의 변경 사항을 로컬 변경 사항에 병합해야합니다. 커밋 할 수 있습니다. 이것은 의미가 있습니다. 이렇게하면 다른 사람의 변경 사항을 가져 와서 코드에 병합하여 코드가 다른 변경 사항과 함께 계속 작동하도록합니다.

어쨌든 단계로 넘어갑니다.

  1. 원래 가져온 브랜치를 가져 오도록 '가져 오기'를 구성하십시오.

  2. 원격 지점을 가져옵니다.

  3. 해당 원격 분기를 로컬 분기에 병합하십시오.

  4. 로컬 리포지토리에서 (병합) 변경 사항을 커밋합니다.

  5. 변경 사항을 원격 저장소로 푸시하십시오.

상세히...

  1. Eclipse에서 'Git Repositories'보기를 엽니 다.

  2. 로컬 저장소가 표시되고 원격 저장소를 하위 폴더로 볼 수 있는지 확인합니다. 제 버전에서는 Remotes라고 불리며 그 안에서 원격 프로젝트를 볼 수 있습니다.

  3. 왼쪽을 가리키는 녹색 화살표를 찾으십시오. 이것은 '가져 오기'화살표입니다. 마우스 오른쪽 버튼을 클릭하고 'Configure Fetch'를 선택합니다.

  4. URI가 표시되고 원격 저장소를 가리키는 지 확인해야합니다.

  5. 팝업의 참조 매핑 섹션을보십시오. 내 것이 비어 있었다. 가져 오려는 원격 참조를 나타냅니다. '추가'를 클릭하십시오.

  6. 원격 저장소에서 가져 오는 데 필요한 브랜치 이름을 입력하십시오. 내 것은 '마스터'였습니다 (btw, 여기 드롭 다운이 좋을 것입니다 !!, 지금은 입력해야합니다). 팝업을 계속 진행하고 결국 '마침'을 클릭합니다.

  7. '저장 및 가져 오기'를 클릭합니다. 원격 참조를 가져옵니다.

  8. 로컬 저장소의 'Branches'폴더를 확인하십시오. 이제 원격 폴더에서 해당 원격 분기를 볼 수 있습니다. 다시 '마스터'가 보입니다.

  9. '마스터'라는 이름의 'Branches'의 'Local'폴더에서 로컬 분기를 마우스 오른쪽 버튼으로 클릭합니다. 'Merge'를 선택한 다음 'origin / master'라는 이름의 원격 지점을 선택합니다.

  10. 병합을 통해 처리합니다.

  11. 로컬 저장소에 대한 변경 사항을 커밋합니다.

  12. 변경 사항을 원격 저장소로 푸시하십시오.

  13. 가서 맛있는 음료를 마시고 자신을 축하하십시오. 나머지는 쉬십시오.


제 경우에는 Force Update밀면서 확인란을 선택했습니다 . 그것은 매력처럼 작동했습니다.


그 동안 (프로젝트를 업데이트하는 동안) '마스터'브랜치에 다른 커밋이 수행되었습니다. 따라서 변경 사항을 푸시하려면 먼저 해당 변경 사항을 가져와야합니다.


Eclipse Luna + Eclipse Git 3.6.1에 적용 가능

나는,

  1. 복제 된 git 저장소
  2. 소스 코드를 일부 변경했습니다.
  3. Git 스테이징 뷰에서 단계적 변경
  4. 마지막으로 커밋하고 푸시하세요!

그리고 EGit에서이 문제에 직면했고 여기에 내가 해결 한 방법이 있습니다 ..

예, 변경 사항을 커밋하기 전에 누군가 변경 사항을 커밋했습니다. 따라서 변경 사항이 거부됩니다. 이 오류 후 변경 사항은 실제로 로컬 저장소에 커밋됩니다. 내가 지적한대로 Pull유지 linear history하고 싶었 기 때문에 변경 만하고 싶지 않았습니다. 어떤 경우에`git pull`이 해로울 수 있습니까?

그래서 다음 단계를 실행했습니다.

  1. from Git Repository perspective, right click on the concerned Git
    project
  2. select Fetch from Upstream - it fetches remote updates (refs and objects) but no updates are made locally. for more info refer What is the difference between 'git pull' and 'git fetch'?
  3. select Rebase... - this open a popup, click on Preserve merges during rebase see why
    What exactly does git's "rebase --preserve-merges" do (and why?)
  4. click on Rebase button
  5. if there is/are a conflict(s), go to step 6 else step 11
  6. a Rebase Result popup would appear, just click on OK
  7. file comparator would open up, you need to modify left side file.
  8. once you are done with merging changes correctly, goto Git Staging view
  9. stage the changes. i.e. add to index
  10. on the same view, click on Rebase-> Continue. repeat 7 to 10 until all conflicts are resolved.
  11. from History view, select your commit row and select Push Commit
  12. select Rebase Commits of local....... checkbox and click next. refer why - Git: rebase onto development branch from upstream
  13. click on Finish

Note: if you have multiple local repository commits, you need to squash them in one commit to avoid multiple merges.


Open git view :

1- select your project and choose merge 2- Select remote tracking 3- click ok

Git will merge the remote branch with local repository

4- then push


Configure After pushing the code when you get a rejected message, click on configure and click Add spec as shown in this picture

Source ref and Destination ref Drop down and click on the ref/heads/yourbranchname and click on Add Spec again

enter image description here Make sure you select the force update

enter image description here Finally save and push the code to the repo


This error means that remote repository has had other commits and has paced ahead of your local branch.
I try doing a git pull followed by a git push. If their are No conflicting changes, git pull gets the latest code to my local branch while keeping my changes intact.
Then a git push pushes my changes to the master branch.


I have found that you must be on the latest commit of the git. So these are the steps to take: 1) make sure you have not been working on the same files, otherwise you will run into a DITY_WORK_TREE error. 2) pull the latest changes. 3) commit your updates.

Hope this helps.


  1. Go in Github an create a repo for your new code.
  2. Use the new https or ssh url in Eclise when you are doing the push to upstream;

참고URL : https://stackoverflow.com/questions/19474186/egit-rejected-non-fast-forward

반응형