[에러 해결] git push error, git pull error

채현·2022년 6월 19일
0

오류 해결

목록 보기
1/1

[해결한 에러 2가지]

1. 리모트에 로컬에 없는 사항이 들어 있으므로 업데이트가 거부되었습니다...

2. You have divergent branches and need to specify how to reconcile them...

[Error 1] git push error

힌트: 리모트에 로컬에 없는 사항이 들어 있으므로 업데이트가
힌트: 거부되었습니다. 이 상황은 보통 또 다른 저장소에서 같은
힌트: 저장소로 푸시할 때 발생합니다. 푸시하기 전에
힌트: ('git pull ...' 등 명령으로) 리모트 변경 사항을 먼저
힌트: 포함해야 합니다.
힌트: 자세한 정보는 'git push --help'의 "Note about fast-forwards' 부분을
힌트: 참고하십시오.

Error 원인

github에서 readme 파일을 만들어서 원격저장소에만 readme file이 있고, local에는 없어서 오류가 생겼다.

해결 과정

1.

git pull origin master

git pull 해서 원격 저장소의 정보를 로컬 저장소로 가져오려 했다.

2.

그런데 여기서 두번째 에러 발생

[Error 2] git pull error

힌트: You have divergent branches and need to specify how to reconcile them.
힌트: You can do so by running one of the following commands sometime before
힌트: your next pull:
힌트:
힌트: git config pull.rebase false # merge
힌트: git config pull.rebase true # rebase
힌트: git config pull.ff only # fast-forward only
힌트:
힌트: You can replace "git config" with "git config --global" to set a default
힌트: preference for all repositories. You can also pass --rebase, --no-rebase,
힌트: or --ff-only on the command line to override the configured default per
힌트: invocation.
fatal: Need to specify how to reconcile divergent branches.

Error 원인

검색해보니 Git v2.27 부터 나오는 메세지라고 한다.

해결 과정

1.

git config pull.rebase false

2.

1번 해주니 git pull 잘 된당

그래서 git pull 하니 내 local에 github에서 작성했던 readme file이 생성됨

그래서 아까 못했던 git push도 잘 되었다!

profile
한 줄 소개

0개의 댓글