728x90
728x90
원격 저장소 주소 변경하는 방법
들어가며
- Git 명령어를 이용하여 현재 프로젝트의 원격(Remote) 저장소 주소를 변경하는 방법을 정리해본다.

방법
현재 원격 저장소주소 확인하기
- 현재 프로젝트에 연결된 원격 저장소 주소를 확인한다.
$ git remote -v
origin https://github.com/old-user/old-repo.git (fetch) origin https://github.com/old-user/old-repo.git (push)
현재 원격 저장소 주소 변경하기
set-url
옵션을 사용하여 원격 저장소 주소를 변경할 수 있다.
$ git remote set-url origin <새로운_원격_저장소_주소>
사용 예
$ git remote set-url origin https://github.com/new-user/new-repo.git
- 그리고 원격 저장소 주소가 변경되었는지 확인한다.
$ git remote -v
origin https://github.com/new-user/new-repo.git (fetch) origin https://github.com/new-user/new-repo.git (push)
새로운 원격 저장소 주소 테스트하기
- 새로운 원격 저장소가 정상적으로 작동하는지 확인한다.
$ gut push origin main
SSH 키를 사용하는 경우, SSH URL 형식(git@github.com:username/repository.git
)을 사용 한다.
참고 사이트
How do I change the URI (URL) for a remote Git repository?
I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved "origin" to a NAS and successfully tested cloning it from here. I would like to know if I can change th...
stackoverflow.com
728x90
728x90
'DevOps > Git' 카테고리의 다른 글
[Git] .gitignore 파일에 환경 설정 파일(.env) 등록하는 방법 (0) | 2024.11.02 |
---|---|
[Git] git push 취소하는 방법 (0) | 2024.10.15 |
[Git] 브랜치 : 원격 저장소의 최신 내용을 가져오고, 기존의 브랜치 내용 지우기 (0) | 2024.02.27 |
[Git] 비주얼 스튜디오 코드(Visual Studio Code)와 깃허브(GitHub) 연동하기 (0) | 2022.06.23 |