reomte를 연결해두고 테스트용으로 커밋&푸시한 폴더를 삭제하고
다른 폴더에서 리모트연결 후 커밋&푸시를 진행
git push origin main
! [rejected] main -> main (fetch first)
error: failed to push some refs to '주소'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
hint에 적힌대로 진행해보았다
git pull origin main
From https://github.com/annkim7/mountain_info
* branch main -> FETCH_HEAD
fatal: refusing to merge unrelated histories
머지 거부가 뜬다
unrelated histories로 검색해보니
git push/pull 할때 fatal: refusing to merge unrelated histories 문제 해결 블로그를 발견했다
리모트에는 있는 커밋기록이 로컬에는 없기 때문에 일치하지 않아 발생하는 오류라고 한다
git pull --allow-unrelated-histories origin main
머지 절차를 거치기 위해 아래와 같이 새 커밋 메시지를 작성하라고 뜬다
git push origin main
Enumerating objects: 19, done.
Counting objects: 100% (19/19), done.
Delta compression using up to 8 threads
Compressing objects: 100% (17/17), done.
Writing objects: 100% (18/18), 45.90 KiB | 11.47 MiB/s, done.
Total 18 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.