Skip to main content
이제 REST API의 버전이 지정되었습니다. 자세한 내용은 "API 버전 관리 정보"를 참조하세요.

원본 가져오기에 대한 REST API 엔드포인트

REST API를 사용하여 Git 원본 리포지토리에서 가져오기를 시작합니다.

원본 가져오기 알아보기

경고: 사용 수준이 매우 낮고 사용 가능한 대안으로 인해 원본 가져오기 API는 사용 중지됨였습니다. 자세한 내용 및 대안은 변경 로그를 참조하세요.

이러한 엔드포인트를 사용하여 다른 서비스와 함께 호스트되는 Git 리포지토리에서 가져오기를 시작할 수 있습니다. 이는 GitHub 가져오기 도구와 동일한 기능입니다. 자세한 내용은 "GitHub Importer를 사용하여 리포지토리 가져오기"을(를) 참조하세요. 일반적인 원본 가져오기는 가져오기를 시작한 다음(선택적으로), 작성자를 업데이트하고/또는 가져오기에 큰 파일이 있는 경우 Git LFS 사용에 대한 기본 설정을 업데이트합니다. 가져오기 상태를 확인하기 위해 RepositoryImportEvent에 대해 수신 대기하는 웹후크를 만들 수도 있습니다.

이러한 엔드포인트는 personal access token (classic)을(를) 사용하는 인증만 지원합니다. 자세한 내용은 "개인용 액세스 토큰 관리"을(를) 참조하세요.

다음 다이어그램은 자세한 예시를 제공합니다.

+---------+                     +--------+                              +---------------------+
| Tooling |                     | GitHub |                              | Original Repository |
+---------+                     +--------+                              +---------------------+
     |                              |                                              |
     |  Start import                |                                              |
     |----------------------------->|                                              |
     |                              |                                              |
     |                              |  Download source data                        |
     |                              |--------------------------------------------->|
     |                              |                        Begin streaming data  |
     |                              |<---------------------------------------------|
     |                              |                                              |
     |  Get import progress         |                                              |
     |----------------------------->|                                              |
     |       "status": "importing"  |                                              |
     |<-----------------------------|                                              |
     |                              |                                              |
     |  Get commit authors          |                                              |
     |----------------------------->|                                              |
     |                              |                                              |
     |  Map a commit author         |                                              |
     |----------------------------->|                                              |
     |                              |                                              |
     |                              |                                              |
     |                              |                       Finish streaming data  |
     |                              |<---------------------------------------------|
     |                              |                                              |
     |                              |  Rewrite commits with mapped authors         |
     |                              |------+                                       |
     |                              |      |                                       |
     |                              |<-----+                                       |
     |                              |                                              |
     |                              |  Update repository on GitHub                 |
     |                              |------+                                       |
     |                              |      |                                       |
     |                              |<-----+                                       |
     |                              |                                              |
     |  Map a commit author         |                                              |
     |----------------------------->|                                              |
     |                              |  Rewrite commits with mapped authors         |
     |                              |------+                                       |
     |                              |      |                                       |
     |                              |<-----+                                       |
     |                              |                                              |
     |                              |  Update repository on GitHub                 |
     |                              |------+                                       |
     |                              |      |                                       |
     |                              |<-----+                                       |
     |                              |                                              |
     |  Get large files             |                                              |
     |----------------------------->|                                              |
     |                              |                                              |
     |  opt_in to Git LFS           |                                              |
     |----------------------------->|                                              |
     |                              |  Rewrite commits for large files             |
     |                              |------+                                       |
     |                              |      |                                       |
     |                              |<-----+                                       |
     |                              |                                              |
     |                              |  Update repository on GitHub                 |
     |                              |------+                                       |
     |                              |      |                                       |
     |                              |<-----+                                       |
     |                              |                                              |
     |  Get import progress         |                                              |
     |----------------------------->|                                              |
     |        "status": "complete"  |                                              |
     |<-----------------------------|                                              |
     |                              |                                              |
     |                              |                                              |

Get an import status

View the progress of an import.

Warning

Endpoint closing down notice: Due to very low levels of usage and available alternatives, this endpoint is closing down and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

Import status

This section includes details about the possible values of the status field of the Import Progress response.

An import that does not have errors will progress through these steps:

  • detecting - the "detection" step of the import is in progress because the request did not include a vcs parameter. The import is identifying the type of source control present at the URL.
  • importing - the "raw" step of the import is in progress. This is where commit data is fetched from the original repository. The import progress response will include commit_count (the total number of raw commits that will be imported) and percent (0 - 100, the current progress through the import).
  • mapping - the "rewrite" step of the import is in progress. This is where SVN branches are converted to Git branches, and where author updates are applied. The import progress response does not include progress information.
  • pushing - the "push" step of the import is in progress. This is where the importer updates the repository on GitHub. The import progress response will include push_percent, which is the percent value reported by git push when it is "Writing objects".
  • complete - the import is complete, and the repository is ready on GitHub.

If there are problems, you will see one of these in the status field:

  • auth_failed - the import requires authentication in order to connect to the original repository. To update authentication for the import, please see the Update an import section.
  • error - the import encountered an error. The import progress response will include the failed_step and an error message. Contact GitHub Support for more information.
  • detection_needs_auth - the importer requires authentication for the originating repository to continue detection. To update authentication for the import, please see the Update an import section.
  • detection_found_nothing - the importer didn't recognize any source control at the URL. To resolve, Cancel the import and retry with the correct URL.
  • detection_found_multiple - the importer found several projects or repositories at the provided URL. When this is the case, the Import Progress response will also include a project_choices field with the possible project choices as values. To update project choice, please see the Update an import section.

The project_choices field

When multiple projects are found at the provided URL, the response hash will include a project_choices field, the value of which is an array of hashes each representing a project choice. The exact key/value pairs of the project hashes will differ depending on the version control type.

Git LFS related fields

This section includes details about Git LFS related fields that may be present in the Import Progress response.

  • use_lfs - describes whether the import has been opted in or out of using Git LFS. The value can be opt_in, opt_out, or undecided if no action has been taken.
  • has_large_files - the boolean value describing whether files larger than 100MB were found during the importing step.
  • large_files_size - the total size in gigabytes of files larger than 100MB found in the originating repository.
  • large_files_count - the total number of files larger than 100MB found in the originating repository. To see a list of these files, make a "Get Large Files" request.

"Get an import status"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (read)

"Get an import status"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

"Get an import status"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

404

Resource not found

503

Unavailable due to service under maintenance.

"Get an import status"에 대한 코드 샘플

요청 예제

get/repos/{owner}/{repo}/import
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/import

Response

Status: 200
{ "vcs": "subversion", "use_lfs": true, "vcs_url": "http://svn.mycompany.com/svn/myproject", "status": "complete", "status_text": "Done", "has_large_files": true, "large_files_size": 132331036, "large_files_count": 1, "authors_count": 4, "url": "https://api.github.com/repos/octocat/socm/import", "html_url": "https://import.github.com/octocat/socm/import", "authors_url": "https://api.github.com/repos/octocat/socm/import/authors", "repository_url": "https://api.github.com/repos/octocat/socm" }

Start an import

Start a source import to a GitHub repository using GitHub Importer. Importing into a GitHub repository with GitHub Actions enabled is not supported and will return a status 422 Unprocessable Entity response.

Warning

Endpoint closing down notice: Due to very low levels of usage and available alternatives, this endpoint is closing down and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

"Start an import"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (write)

"Start an import"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

본문 매개 변수
속성, 형식, 설명
vcs_url string Required

The URL of the originating repository.

vcs string

The originating VCS type. Without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response.

다음 중 하나일 수 있습니다.: subversion, git, mercurial, tfvc

vcs_username string

If authentication is required, the username to provide to vcs_url.

vcs_password string

If authentication is required, the password to provide to vcs_url.

tfvc_project string

For a tfvc import, the name of the project that is being imported.

"Start an import"에 대한 HTTP 응답 상태 코드

상태 코드설명
201

Created

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

503

Unavailable due to service under maintenance.

"Start an import"에 대한 코드 샘플

요청 예제

put/repos/{owner}/{repo}/import
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/import \ -d '{"vcs":"subversion","vcs_url":"http://svn.mycompany.com/svn/myproject","vcs_username":"octocat","vcs_password":"secret"}'

Response

Status: 201
{ "vcs": "subversion", "use_lfs": true, "vcs_url": "http://svn.mycompany.com/svn/myproject", "status": "importing", "status_text": "Importing...", "has_large_files": false, "large_files_size": 0, "large_files_count": 0, "authors_count": 0, "commit_count": 1042, "url": "https://api.github.com/repos/octocat/socm/import", "html_url": "https://import.github.com/octocat/socm/import", "authors_url": "https://api.github.com/repos/octocat/socm/import/authors", "repository_url": "https://api.github.com/repos/octocat/socm" }

Update an import

An import can be updated with credentials or a project choice by passing in the appropriate parameters in this API request. If no parameters are provided, the import will be restarted.

Some servers (e.g. TFS servers) can have several projects at a single URL. In those cases the import progress will have the status detection_found_multiple and the Import Progress response will include a project_choices array. You can select the project to import by providing one of the objects in the project_choices array in the update request.

Warning

Endpoint closing down notice: Due to very low levels of usage and available alternatives, this endpoint is closing down and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

"Update an import"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (write)

"Update an import"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

본문 매개 변수
속성, 형식, 설명
vcs_username string

The username to provide to the originating repository.

vcs_password string

The password to provide to the originating repository.

vcs string

The type of version control system you are migrating from.

다음 중 하나일 수 있습니다.: subversion, tfvc, git, mercurial

tfvc_project string

For a tfvc import, the name of the project that is being imported.

"Update an import"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

503

Unavailable due to service under maintenance.

"Update an import"에 대한 코드 샘플

요청 예제

patch/repos/{owner}/{repo}/import
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/import \ -d '{"vcs_username":"octocat","vcs_password":"secret"}'

Example 1

Status: 200
{ "vcs": "subversion", "use_lfs": true, "vcs_url": "http://svn.mycompany.com/svn/myproject", "status": "detecting", "url": "https://api.github.com/repos/octocat/socm/import", "html_url": "https://import.github.com/octocat/socm/import", "authors_url": "https://api.github.com/repos/octocat/socm/import/authors", "repository_url": "https://api.github.com/repos/octocat/socm" }

Cancel an import

Stop an import for a repository.

Warning

Endpoint closing down notice: Due to very low levels of usage and available alternatives, this endpoint is closing down and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

"Cancel an import"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (write)

"Cancel an import"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

"Cancel an import"에 대한 HTTP 응답 상태 코드

상태 코드설명
204

No Content

503

Unavailable due to service under maintenance.

"Cancel an import"에 대한 코드 샘플

요청 예제

delete/repos/{owner}/{repo}/import
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/import

Response

Status: 204

Get commit authors

Each type of source control system represents authors in a different way. For example, a Git commit author has a display name and an email address, but a Subversion commit author just has a username. The GitHub Importer will make the author information valid, but the author might not be correct. For example, it will change the bare Subversion username hubot into something like hubot <hubot@12341234-abab-fefe-8787-fedcba987654>.

This endpoint and the Map a commit author endpoint allow you to provide correct Git author information.

Warning

Endpoint closing down notice: Due to very low levels of usage and available alternatives, this endpoint is closing down and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

"Get commit authors"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (read)

"Get commit authors"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

쿼리 매개 변수
속성, 형식, 설명
since integer

A user ID. Only return users with an ID greater than this ID.

"Get commit authors"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

404

Resource not found

503

Unavailable due to service under maintenance.

"Get commit authors"에 대한 코드 샘플

요청 예제

get/repos/{owner}/{repo}/import/authors
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/import/authors

Response

Status: 200
[ { "id": 2268557, "remote_id": "nobody@fc7da526-431c-80fe-3c8c-c148ff18d7ef", "remote_name": "nobody", "email": "hubot@github.com", "name": "Hubot", "url": "https://api.github.com/repos/octocat/socm/import/authors/2268557", "import_url": "https://api.github.com/repos/octocat/socm/import" }, { "id": 2268558, "remote_id": "svner@fc7da526-431c-80fe-3c8c-c148ff18d7ef", "remote_name": "svner", "email": "svner@fc7da526-431c-80fe-3c8c-c148ff18d7ef", "name": "svner", "url": "https://api.github.com/repos/octocat/socm/import/authors/2268558", "import_url": "https://api.github.com/repos/octocat/socm/import" }, { "id": 2268559, "remote_id": "svner@example.com@fc7da526-431c-80fe-3c8c-c148ff18d7ef", "remote_name": "svner@example.com", "email": "svner@example.com@fc7da526-431c-80fe-3c8c-c148ff18d7ef", "name": "svner@example.com", "url": "https://api.github.com/repos/octocat/socm/import/authors/2268559", "import_url": "https://api.github.com/repos/octocat/socm/import" } ]

Map a commit author

Update an author's identity for the import. Your application can continue updating authors any time before you push new commits to the repository.

Warning

Endpoint closing down notice: Due to very low levels of usage and available alternatives, this endpoint is closing down and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

"Map a commit author"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (write)

"Map a commit author"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

author_id integer Required
본문 매개 변수
속성, 형식, 설명
email string

The new Git author email.

name string

The new Git author name.

"Map a commit author"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

503

Unavailable due to service under maintenance.

"Map a commit author"에 대한 코드 샘플

요청 예제

patch/repos/{owner}/{repo}/import/authors/{author_id}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/import/authors/AUTHOR_ID \ -d '{"email":"hubot@github.com","name":"Hubot the Robot"}'

Response

Status: 200
{ "id": 2268557, "remote_id": "nobody@fc7da526-431c-80fe-3c8c-c148ff18d7ef", "remote_name": "nobody", "email": "hubot@github.com", "name": "Hubot", "url": "https://api.github.com/repos/octocat/socm/import/authors/2268557", "import_url": "https://api.github.com/repos/octocat/socm/import" }

Get large files

List files larger than 100MB found during the import

Warning

Endpoint closing down notice: Due to very low levels of usage and available alternatives, this endpoint is closing down and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

"Get large files"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (read)

"Get large files"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

"Get large files"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

503

Unavailable due to service under maintenance.

"Get large files"에 대한 코드 샘플

요청 예제

get/repos/{owner}/{repo}/import/large_files
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/import/large_files

Response

Status: 200
[ { "ref_name": "refs/heads/master", "path": "foo/bar/1", "oid": "d3d9446802a44259755d38e6d163e820", "size": 10485760 }, { "ref_name": "refs/heads/master", "path": "foo/bar/2", "oid": "6512bd43d9caa6e02c990b0a82652dca", "size": 11534336 }, { "ref_name": "refs/heads/master", "path": "foo/bar/3", "oid": "c20ad4d76fe97759aa27a0c99bff6710", "size": 12582912 } ]

Update Git LFS preference

You can import repositories from Subversion, Mercurial, and TFS that include files larger than 100MB. This ability is powered by Git LFS.

You can learn more about our LFS feature and working with large files on our help site.

Warning

Endpoint closing down notice: Due to very low levels of usage and available alternatives, this endpoint is closing down and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the changelog.

"Update Git LFS preference"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (write)

"Update Git LFS preference"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

본문 매개 변수
속성, 형식, 설명
use_lfs string Required

Whether to store large files during the import. opt_in means large files will be stored using Git LFS. opt_out means large files will be removed during the import.

다음 중 하나일 수 있습니다.: opt_in, opt_out

"Update Git LFS preference"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

422

Validation failed, or the endpoint has been spammed.

503

Unavailable due to service under maintenance.

"Update Git LFS preference"에 대한 코드 샘플

요청 예제

patch/repos/{owner}/{repo}/import/lfs
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/import/lfs \ -d '{"use_lfs":"opt_in"}'

Response

Status: 200
{ "vcs": "subversion", "use_lfs": true, "vcs_url": "http://svn.mycompany.com/svn/myproject", "status": "complete", "status_text": "Done", "has_large_files": true, "large_files_size": 132331036, "large_files_count": 1, "authors_count": 4, "url": "https://api.github.com/repos/octocat/socm/import", "html_url": "https://import.github.com/octocat/socm/import", "authors_url": "https://api.github.com/repos/octocat/socm/import/authors", "repository_url": "https://api.github.com/repos/octocat/socm" }