본문으로 바로가기
COMMUNITY모든 이야기

git push 시 rejected 에러가 발생하며 push가 되지 않는 문제

빗방울 2026.10.31 14:16 2분 읽기 조회 19 · 추천 2

토이 프로젝트를 진행하며 로컬에서 작업한 내용을 원격 저장소에 처음으로 업로드하려고 합니다.

코드:

git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/username/toy-project.git
git push origin main

오류: error: failed to push some refs to 'https://github.com/username/toy-project.git'

hint: Updates were rejected because the remote contains work that you do

hint: not have locally. 'git pull --rebase' expected.

시도: git push 명령어를 여러 번 다시 입력해 보았으나 동일한 에러가 발생했습니다.

질문: 원격 저장소에 이미 파일이 있는 상태에서 로컬 저장소의 내용을 처음 push 하려면 어떻게 해결해야 하나요?

모든 이야기1488

가벼운 안부부터 깊은 생각까지, 함께 나눠요.

글쓰기
총 1488개의 이야기
댓글