git

[Github] github respository 변경과 git origin 재설정

pogles 2023. 4. 6. 00:05

github 의 respository 명을 변경하면서 기존 remote 해두었던 origin 을 재설정하면서 찾은 방법이다.

 

1. github respository 명 변경.

 

2. 기존연결된 origin 에서 remote(연결)끊고 다시 remote(연결) 하기

git remote -v // 연결되어있나 재확인

git remote remove origin // 연결끊기

git remote add origin "이름변경한 gitub의 url주소" // 재연결

 

3-1. github respository 가져오기 (git clone / git pull)

git pull origin main // **main 은 가져올 branch

 

3-2. 3-1 에서 fatal: refusing to merge unrelated histories 발생시

 

* 서로 관련이 없는 두 프로젝트를 병합할때, git 이 거부하는 오류

git pull origin main --allow-unrelated-histories