develog

[git] git repository 미러링하기 본문

카테고리 없음

[git] git repository 미러링하기

냐옴 2024. 5. 7. 09:58

 

복제할 리포지토리를 mirror clone 한다

## --mirror 대신에 --bare 를 사용한다
$ git clone --mirror git@github.com:userA/mirror-source-proj
$ git clone --bare git@github.com:userA/mirror-source-proj

 

복제한 리포지토리를 신규 리포지토리로 mirror push 한다

- push 하기 전에 신규 리포지토리를 먼저 생성한다

$ cd mirror-source-proj
$ git fetch
$ git push --mirror git@github.com:userB/mirror-target-proj

 

`git clone --mirror` 를 사용할 경우 아래 오류가 발생할 수 있음

 ! [remote rejected] refs/pull/1/head -> refs/pull/1/head (deny updating a hidden ref)
 ! [remote rejected] refs/pull/1/merge -> refs/pull/1/merge (deny updating a hidden ref)

 

원본 리포지토리와 미러 리포지토리 디렉토리 구조

 

Comments