#TIL #git origin 리모트 저장소 변경

$ cd existing_repo
$ git remote rename origin old-origin
$ git remote add origin new_repo_url
$ git push -u origin --all
$ git push -u origin --tags
$ git remote remove old-origin

저장소를 만드니 gitlab이 안내해줬다.

$ git remote remove origin

이름 변경 없이 지운 후에 진행해도 된다.

u 옵션을 붙여서 upstream 설정도 같이해준다. 로컬 브랜치가 tracking 하는 리모트 브랜치다. 이 정보가 없으면 push를 할 때, 매번 로컬 브랜치와 리모트 브랜치를 적어줘야 한다.

Feedback plz <3 @ohyecloudy, ohyecloudy@gmail.com

A Random Post