less than 1 minute read

기존에 존재하는 repository 복제 방법

만약 기존 Git repository 현재 버전을 복사하여 다른 project에서 활용하고자 하는 경우,
혹은 사내 private Github 사용으로 인해 fork를 사용할 수 없는 경우,
git clonemirror option 옵션을 이용해 기존의 Repository를 복제할 수 있습니다.

Mirror clone

Mirror clone은 기존 repository의 모든 참조을 가져오는 것을 말합니다.
여기서 참조란 commit log, branch를 포함한 모든 이력 및 repository 자체를 뜻합니다.
아래와 같이 mirror clone을 통해 기존 repository를 clone합니다.

git clone --mirror {old_repository_url}

Git(Hub)에 새로 만든 repository로 push

위 단계에서 mirror clone한 repository를 새로 만든 repository로 push합니다.

cd {old_repository_name}.git
git remote set-url --push origin {new_repository_url}
git push --mirror

GitHub에서 새로운 repository 생성 방법은 아래 post를 참조하시기 바랍니다.

[Blog link]


[Git] Create git repository

less than 1 minute read

새로운 repository 생성 방법 echo "# New repository" >> README.md // 새로운 파일 생성 혹은 기존 작성된 파일 copy git init git add README.md git commit -m "first commit" g...

Leave a comment