원본 Git: https://github.com/roonapim/a.git
복사 Git: https://github.com/roonapim/b.git
원격 연결
$ git remote add origin https://github.com/roonapim/b.git
원본 git 카피
$ git clone https://github.com/roonapim/a.git
원본 메인 브랜치 확인 후 해당 브랜치로 체크아웃
나의 default 브랜치는 main임!!!
$ git branch
$ git checkout main // git checkout master
복사 준비
git clone 명령어와 함께 --mirror 옵션을 이용.
명령어 실행 후 레파지토리 명의 디렉터리가 생긴다.
이 디렉터리 명을 .git 으로 바꾼다.
$ git clone --mirror https://github.com/roonapim/a.git //원본 Git 똑같이 복사
$ mv a.git .git //a.git 폴더를 .git 폴더로 변경
새 레파지토리로 연결
$ git remote set-url origin https://github.com/roonapim/b.git
$ git push --mirror //가져온 clon mirror정보를 push
❗ Tip. 레파지토리 권한이 없어진 경우
예전엔 권한이 있었지만 지금은 권한이 없어 로컬에만 존재하는 레파지토리가 있을 수 있다. 이 때는 레파지토리 주소를 사용할 수가 없다.
이 상황을 해결하기 위해 레파지토리 루트 디렉터리에 존재하는 .git 디렉터리를 지정해주면 된다.
$ git clone --mirror ./.git
[Git] Git이란? (0) | 2022.10.14 |
---|---|
[Git] mergetool (0) | 2022.10.12 |
[Git] Commit tamplate file (0) | 2022.10.12 |
[Git] Cherry-pick (0) | 2022.10.11 |
[Git] Merge 되돌리기 (0) | 2022.10.11 |
댓글 영역