본문 바로가기

Programming/Tools

[Git] 레포지토리 옮기기

예제에 사용된 git 저장소는 github입니다. (bitbucket,gitlab 등에서도 사용가능합니다.)

/* 옮기고자 하는 레포지토리를 로컬에 clone */
$ git clone --mirror https://github.com/{user}/{source-repository-name}.git

/* clone받은 레포지토리로 이동 */
$ cd {source-repository-name}.git

/* remote 레포지토리 url을 변경 */
git remote set-url --push origin https://github.com/{user}/{target-repository-name}.git

/* 신규 레포지토리로 clone 받은 소스들을 push */
git push --mirror