오늘 블록 만들어 쌓기

[github] fatal: remote origin already exists 본문

Dev

[github] fatal: remote origin already exists

jwstyle 2020. 4. 17. 21:32

로컬에서 개발하던 소스를 github에 업로드 하기 위해 github에 저장소를 만들고 

github 가이드를 따라 push를 하려는데, 

$ git init
$ git config --global user.email "내이메일"
$ git config --global user.name "내이름"
$ git add .
$ git commit -m "첫 커밋"
$ git remote add origin git@github.com:계정/프로젝트이름.git
fatal: remote origin already exists

fatal: remote origin already exists -> 메시지를 만났다면, 

$ git remote rm origin -> 이렇게 입력합니다.

$ git remote rm origin
$ git remote add git@github.com:계정/프로젝트.git
$ git push -u origin master

정상적으로  push 할 수 있습니다.

** ssh키 설정을 하지 않은경우는 github에 있는 https로된 주소를 쓰면 됨.