티스토리 뷰

GitHub & Gitlab

GIT 레파지토리 복사

Grand_J 2022. 10. 13. 13:35
반응형

GIT 레파지토리 복사

기존 commit 내역까지 복사하고 싶을때 사용

 

1. 기존 레파지토리 복사

// 모든 브랜치
git clone --bare 기존 레파지토리주소
ex) git clone --bare https://github.com/xxx/xxx.git

// 특정 브랜치
git clone -b 브랜치명 --single-branch --bare 기존 레파지토리주소
ex) git clone -b main --single-branch --bare https://github.com/xxx/xxx.git

 

2. 생성된 폴더명 변경

// 복사된 폴더명 변경
xxx.git > .git

 

3. 복사할 레파지토리에 연결

.git 폴더로 이동

// 새로운 레파지토리로 연결
// URL
git remote set-url origin 신규 레파지토리 url
ex) git remote set-url origin https://github.com/new/new.git

// SSH
git remote set-url origin 신규 레파지토리 ssh
ex) git remote set-url origin git@github.com/new.git

 

4. 새로운 레파지토리에 푸시

// 새로 연결된 레파지토리에 push
git push --mirror

 

끗!@$#!#%!#%

 

 

반응형