{"meta":{"title":"하위 폴더를 새 리포지토리로 분할","intro":"Git 리포지토리 내의 폴더를 새 리포지토리로 전환할 수 있습니다.","product":"시작하기","breadcrumbs":[{"href":"/ko/enterprise-cloud@latest/get-started","title":"시작하기"},{"href":"/ko/enterprise-cloud@latest/get-started/using-git","title":"Git 사용"},{"href":"/ko/enterprise-cloud@latest/get-started/using-git/splitting-a-subfolder-out-into-a-new-repository","title":"하위 폴더 분할"}],"documentType":"article"},"body":"# 하위 폴더를 새 리포지토리로 분할\n\nGit 리포지토리 내의 폴더를 새 리포지토리로 전환할 수 있습니다.\n\n> \\[!NOTE]\n> 다음 지침을 따르려면 Git 버전 2.22.0 이상이 필요하며 그러지 않으면 `git filter-repo`가 작동하지 않습니다.\n\n리포지토리의 새 복제본을 만드는 경우 폴더를 별도의 리포지토리로 분할할 때 Git 기록이나 변경 내용이 손실되지 않습니다. 그러나 새 리포지토리에는 기존 리포지토리의 분기와 태그가 없습니다.\n\n1. <span class=\"platform-mac\">터미널</span><span class=\"platform-linux\">터미널</span><span class=\"platform-windows\">Git Bash</span>를 엽니다.\n\n2. 현재 작업 디렉터리를 새 리포지토리를 만들 위치로 변경합니다.\n\n3. 하위 폴더가 포함된 리포지토리를 복제합니다.\n\n   ```shell\n   git clone https://github.com/USERNAME/REPOSITORY-NAME\n   ```\n\n4. 현재 작업 디렉터리를 복제된 리포지토리로 변경합니다.\n\n   ```shell\n   cd REPOSITORY-NAME\n   ```\n\n5. 리포지토리의 나머지 파일에서 하위 폴더를 필터링하려면 다음 인수를 사용하여 [`git-filter-repo`](https://github.com/newren/git-filter-repo)를 설치한 다음 `git filter-repo`를 실행합니다.\n\n   * `FOLDER-NAME`: 별도의 리포지토리를 만들려는 프로젝트 내의 폴더입니다.\n\n   <div class=\"ghd-tool windows\">\n\n   > \\[!TIP]\n   > Windows 사용자는 `/` 사용하여 폴더를 구분해야 합니다.\n\n   </div>\n\n   ```shell\n   $ git filter-repo --path FOLDER-NAME/\n   # Filter the specified branch in your directory and remove empty commits\n   ```\n\n   이제 리포지토리에는 하위 폴더에 있던 파일만 포함되어 있습니다.\n\n   특정 하위 폴더 하나를 새 리포지토리의 새 루트 폴더로 설정하고자 하는 경우, 다음 명령을 사용하면 됩니다.\n\n   ```shell\n   $ git filter-repo --subdirectory-filter FOLDER-NAME\n   # Filter the specific branch by using a single sub-directory as the root for the new repository\n   ```\n\n6. GitHub에 [새 리포지토리를 만듭니다](/ko/enterprise-cloud@latest/repositories/creating-and-managing-repositories/creating-a-new-repository).\n\n7. GitHub의 빠른 설정 페이지에서 새 리포지토리의 상단에 있는 <svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-copy\" aria-label=\"Copy to clipboard\" role=\"img\"><path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\"></path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\"></path></svg>을(를) 클릭하여 원격 리포지토리 URL을 복사합니다.\n\n   ![리포지토리의 \"빠른 설정\" 헤더 스크린샷. 원격 URL 옆에 겹쳐진 두 사각형의 아이콘이 주황색 윤곽선으로 표시됩니다.](/assets/images/help/repository/copy-remote-repository-url-quick-setup.png)\n\n   > \\[!TIP]\n   > HTTPS와 SSH URL 간의 차이점에 대한 자세한 내용은 [원격 리포지토리 정보](/ko/enterprise-cloud@latest/get-started/git-basics/about-remote-repositories)을(를) 참조하세요.\n\n8. 리포지토리에 대해 복사한 URL을 사용하여 새 원격 이름을 추가합니다. 예를 들어 일반적으로 선택하는 두 가지는 `origin` 또는 `upstream`입니다.\n\n   ```shell\n   git remote add origin https://github.com/USERNAME/REPOSITORY-NAME.git\n   ```\n\n9. 원격 URL이 새 리포지토리 이름으로 추가되었는지 확인합니다.\n\n   ```shell\n   $ git remote -v\n   # Verify new remote URL\n   > origin  https://github.com/USERNAME/NEW-REPOSITORY-NAME.git (fetch)\n   > origin  https://github.com/USERNAME/NEW-REPOSITORY-NAME.git (push)\n   ```\n\n10. GitHub의 새 리포지토리에 변경 내용을 푸시합니다.\n\n    ```shell\n    git push -u origin BRANCH-NAME\n    ```"}