-
[Git] 리모트 레포지토리 (Remote Repository) 변경Study Bits 2023. 11. 7. 23:44
개발을 하다보면 clone한 레포지토리를 다른 레포지토리에 연결하거나 할 때 리모트 레포지토리 변경이 필요하다.
이미 연결된 Remote 가 있는 경우
현재 연결된 레포지토리(Repository) 조회
git remote -v
연결된 리모트 삭제 (Remove the existing remote)
git remote remove origin
연결된 리모트 이름을 다른 이름으로 바꾸기
git remote rename <old-name> <new-name> # git remote rename origin backup
새로운 Remote 연결하기
새로운 리모트 연결해주기 (Update the existing remote's url)
# 1 git remote set-url <REMOTE-NAME> <NEW-URL> # git remote set-url origin https://github.com/git/git.git # 2 git remote add origin https://github.com/pooh7159/react-board.git git branch -M main git push -u origin main
References
https://www.cloudbees.com/blog/remote-origin-already-exists-error
What "Remote Origin Already Exists" Error Means and How To Fix It
Remote origin already exists is a common error message you might stumble upon when using Git. Learn why that error message happens and how you can address it.
www.cloudbees.com