[Github] 협업시 공용 프로젝트에 코드가 잘못 올라갈경우 case-1
에러상황
소스트리를 사용하는도중 내 프로젝트를 github에 등록할려고 했으나 전체 공용 프로젝트에 내 코드가 올라가는 오류가 발생..
프로젝트 등록부터
시작부터 already exist 라는 문구가 보여서 이상했고,
또한, 아래와같은 에러가 나오기도했다.
➜ test git:(master) git push -u origin master To ex) https://github.com/~~~
! [rejected] master -> master (fetch first) error: failed to push some refs to ' ex) 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 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.
이부분에 대한 해결방법을 찾았는데 적용해서 아래 명령으로 강제로 푸쉬를 해주니
$ git push origin +master
결국, 클론을 받았던 부모 프로젝트가 변경됬다ㅠ
해결방법
원인을 찾아보니 이미 존재하는 주소인데 강제 푸쉬를해서 원래 부모 프로젝트에 새롭게 갱신됨.. ( 같이 프로젝트한 현업자분에게 들은건데 git init을 했어도 따로 설정을 해주면 해결이 가능하다고 한다? - 이부분은 나중에 좀 더 알아봐야겠다)
- 근본적인 해결방법은 아래와 같은것같다.
즉, 연결고리를 제거후 다시 연결해주면 된다
cf) 또한 git origin add에서 add를 빼먹었는데 이부분도 조심하자!
소스트리를 처음 배우고 협업을 하면서 처음부터 오류가 나오는데 해결해서 다행이다ㅎㅎ