프로그래밍/문제

git push 에러 (Error: Failed To Push Some Refs To)

카너먼 2022. 4. 21. 15:17

! [rejected]        master -> master (fetch first)

error: failed to push some refs to 'https://github.com/~

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

hint: not have locally. This is usually caused by another repository pushinghint: to the same ref. 

You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

원인은 깃의 원격 저장소와 현재 로컬 저장소가 동기화되어있지 않기때문이라고 함.


해결방법은 동기화 시켜주니 해결됐다.

 

1. git pull origin master(또는 main)

 

2. git push origin master(main)