거부 된 마스터-> 마스터 (빨리 감기)
프로젝트 (새 저장소의 모든 파일)를 푸시하려고합니다. 나는 단계를 따르지 만 푸시 git push -u origin master
하면이 오류가 발생합니다.
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:asantoya/projectnewbies.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
이 오류가 여러 번 발생하여 어떻게해야하는지 알 수 없습니다.
오류 메시지에 표시된 것처럼 : git pull
시도하기 전에 git push
. 현지 지점이 추적 지점과 동기화되지 않은 것 같습니다.
프로젝트 규칙 및 워크 플로에 따라 사용할 수도 있습니다 git pull --rebase
.
주의 사항 : 이것은 git을 권장하지 않습니다. 리모컨의 변경 사항을 덮어 씁니다. 로컬 변경 사항을 원격 마스터로 푸시해야한다는 것을 100 % 알고있는 경우에만이를 수행하십시오.
이 시도: git push -f origin master
이 명령은 나를 위해 잘 작동했습니다
git push -f origin master
방금이 오류가 발생했습니다.
로컬 git 리포지토리를 만든 후 github 리포지토리를 만들었으므로 github으로 푸시하기 전에 로컬 변경 사항을 수락해야했습니다. 이 경우 github 리포지토리를 생성 할 때 선택적 단계로 생성 된 readme 파일 만 변경되었습니다.
git pull https://github.com/*username*/*repository*.git master
저장소 URL은 프로젝트 github 페이지의 여기에서 가져옵니다.
그런 다음 다시 초기화되었습니다 (필요하지 않을 수도 있음)
git init
git add .
git commit -m "update"
그런 다음 :
git push
나는 github에서 새로운 저장소를 만들었고 같은 문제가 있었지만 당기는 동안 문제가 있었기 때문에 이것이 나를 위해 일했다.
그러나 이것은 모든 코드를 망칠 수 있으므로 이미 많은 코드가있는 repos에서는 권장되지 않습니다.
git push origin master --force
경고:
' git pull
'로 가는 것은 항상 해결책이 아니므로 조심하십시오. 저장소 히스토리를 의도적으로 변경 한 경우이 문제점 (Q에서 언급 된 문제점)에 직면 할 수 있습니다. 이 경우 git은 기록 변경 사항을 원격 저장소의 새로운 변경 내용과 혼동합니다. 따라서 git push --force
호출 git pull
하면 의도적으로 내력에 대한 모든 변경 사항이 실행 취소되므로을 방문해야합니다 .
git pull
도움 이 되지 않으면 변경 사항을 푸시 한 후 (A) 변경 사항 git commit --amend
을 추가 한 데 사용한 것입니다 (B). 따라서 git은 히스토리를 잃을 수 있다고 생각합니다-A의 모든 변경 사항이 포함되어 있지만 B는 다른 커밋으로 해석됩니다.
B
/
---X---A
아무도 이후 A
에 repo를 변경 하지 않으면 그렇게 할 수 있습니다 git push --force
.
그러나 A
다른 사람으로부터 변경이 발생한 경우 :
B
/
---X---A---C
그런 다음 개인 A
이 B
( C
-> D
)로 변경 한 것을 리베이스해야합니다 .
B---D
/
---X---A---C
또는 수동으로 문제를 해결하십시오. 아직 그렇게하는 방법을 생각하지 못했습니다.
이 명령을 사용하십시오 :
git pull --allow-unrelated-histories <nick name of repository> <branch name>
처럼:
git pull --allow-unrelated-histories origin master
이 오류는 프로젝트에 공통 조상이 없을 때 발생합니다.
이것은 마스터에서 약간의 변경을 수행했기 때문에 프로젝트가 먼저 가져 오기를 요청하기 때문입니다. 어쨌든 밀어 넣으려면 다음을 입력하여 무차별 대입을 사용할 수 있습니다.
git push -f origin master
먼저 변경 사항을 커밋하십시오.
git add .
git commit -m "Your commit message"
! [거부 됨] 마스터-> 마스터 (빨리 감기)
당황하지 마십시오. 이것은 매우 쉽게 고칠 수 있습니다. 풀을 발행하기 만하면 지점이 빨리 진행됩니다.
$ git pull myrepo 마스터
그런 다음 푸시를 다시 시도하면 모든 것이 정상입니다.
$ git push github 마스터
Try this command: "git pull origin master"
It worked for me.
Check this link: https://help.github.com/articles/dealing-with-non-fast-forward-errors
This happened to me when I was on develop branch and my master branch is not with latest update.
So when I tried to git push from develop branch I had that error.
I fixed it by switching to master branch, git pull, then go back to develop branch and git push.
$ git fetch && git checkout master
$ git pull
$ git fetch && git checkout develop
$ git push
You need to do
git branch
if the output is something like:
* (no branch)
master
then do
git checkout master
Make sure you do not have any pending commits as checking out will lose all non-committed changes.
I had this problem on a development machine. The dev
branch was pushing fine but the the master
branch gave me (while git push
ing when being on the dev
branch):
! [rejected] master -> master (non-fast-forward)
So I tried:
git checkout master
git pull
Which gave me:
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either.
I found out the master branch was missing from .git/config
and added:
[branch "master"]
remote = origin
merge = refs/heads/master
Afterwards git push
also worked fine on the dev
branch.
I had same as issue. I use Git Totoise. Just Right Click ->TotoiseGit -> Clean Up . Now you can push to Github It worked fine with me :D
This is because you have made conflicting changes to its master. And your repository server is not able to tell you that with these words, so it gives this error because it is not a matter of him deal with these conflicts for you, so he asks you to do it by itself. As ?
1- git pull
This will merge your code from your repository to your code of your site master. So conflicts are shown.
2- treat these manualemente conflicts.
3-
git push origin master
And presto, your problem has been resolved.
이 문제를 해결할 수있는 유일한 것은 로컬 및 자식 저장소를 삭제하고 양쪽 끝에서 다시 동일하게 만드는 것입니다. 지금은 잘 작동합니다.
내 리모컨이 로컬과 동기화되지 않아서 저에게 효과적이었습니다.
git pull --rebase
git pull
다시 할 때 이미 최신 상태 여야하며 이제 원점으로 넘어갈 준비가 되었는지 확인하십시오.
이미 가지고 있다고 가정 git remote add origin remote repository URL
하다
`git push origin master`
heroku로 푸시하려고 할 때 누군가이 오류가 발생하면 다음과 같이 'origin'을 'heroku'로 바꾸십시오 : git push -f heroku master
참고 URL : https://stackoverflow.com/questions/11696295/rejected-master-master-non-fast-forward
'Programming' 카테고리의 다른 글
특정 시점에 할당 된 문제를 찾는 방법은 무엇입니까? (0) | 2020.05.15 |
---|---|
window.location.href = window.location.href와 window.location.reload ()의 차이점 (0) | 2020.05.15 |
명령 출력을 Makefile 변수에 지정하는 방법 (0) | 2020.05.14 |
스토리 보드의 테이블 헤더 뷰 (0) | 2020.05.14 |
JavaScript "new Array (n)"및 "Array.prototype.map"기묘함 (0) | 2020.05.14 |