배포 키에 대한 REST API 엔드포인트
REST API를 사용하여 배포 키 만들고 관리합니다.
배포 키 정보
배포 키를 사용하여 서버에 대한 GitHub.com 리포지토리에서 프로젝트를 시작할 수 있습니다. 이것은 단일 리포지토리에 대한 액세스 권한을 부여하는 SSH 키입니다. 는 키의 퍼블릭 부분을 개인 계정 대신 리포지토리에 직접 연결하고 키의 프라이빗 부분은 서버에 남아 있습니다. 자세한 내용은 배포 제공을(를) 참조하세요.
배포 키는 다음 API 엔드포인트를 사용하거나 GitHub 웹 인터페이스를 사용하여 설정할 수 있습니다. 웹 인터페이스에서 배포 키를 설정하는 방법을 알아보려면 배포 키 관리을(를) 참조하세요.
배포 키가 다른 활동에 의해 삭제되는 경우 몇 가지는 다음과 같습니다.
- personal access token을(를) 사용하여 배포 키를 만든 경우 personal access token을(를) 삭제하면 배포 키가 삭제됩니다. personal access token을(를) 다시 생성해도 배포 키가 삭제되지 않습니다.
- OAuth app 토큰을 사용하여 배포 키를 만든 경우 토큰을 해지하면 배포 키가 삭제됩니다.
반대로 이러한 활동은 수행해도 배포 키가 삭제되지 않습니다.
- GitHub App 사용자 액세스 토큰을 사용하여 배포 키를 만든 경우 토큰을 해지해도 배포 키 삭제되지 않습니다.
- GitHub App 설치 액세스 토큰을 사용하여 배포 키를 만든 경우 앱을 제거하거나 삭제해도 배포 키는 삭제되지 않습니다.
- personal access token을(를) 사용하여 배포 키를 만든 경우 personal access token을(를) 다시 생성하더라도 배포 키는 삭제되지 않습니다.
List deploy keys
"List deploy keys"에 대한 세분화된 액세스 토큰
이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:
세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:
- "Administration" repository permissions (read)
"List deploy keys"에 대한 매개 변수
속성, 형식, 설명 |
---|
accept string Setting to |
속성, 형식, 설명 |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
속성, 형식, 설명 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 기본값: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 기본값: |
"List deploy keys"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
"List deploy keys"에 대한 코드 샘플
요청 예제
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/keys
Response
Status: 200
[
{
"id": 1,
"key": "ssh-rsa AAA...",
"url": "https://api.github.com/repos/octocat/Hello-World/keys/1",
"title": "octocat@octomac",
"verified": true,
"created_at": "2014-12-10T15:53:42Z",
"read_only": true,
"added_by": "octocat",
"last_used": "2022-01-10T15:53:42Z",
"enabled": true
}
]
Create a deploy key
You can create a read-only deploy key.
"Create a deploy key"에 대한 세분화된 액세스 토큰
이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:
세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:
- "Administration" repository permissions (write)
"Create a deploy key"에 대한 매개 변수
속성, 형식, 설명 |
---|
accept string Setting to |
속성, 형식, 설명 |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
속성, 형식, 설명 |
---|
title string A name for the key. |
key string RequiredThe contents of the key. |
read_only boolean If Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see "Repository permission levels for an organization" and "Permission levels for a user account repository." |
"Create a deploy key"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
201 | Created |
422 | Validation failed, or the endpoint has been spammed. |
"Create a deploy key"에 대한 코드 샘플
요청 예제
curl -L \
-X POST \
-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/keys \
-d '{"title":"octocat@octomac","key":"ssh-rsa AAA...","read_only":true}'
Response
Status: 201
{
"id": 1,
"key": "ssh-rsa AAA...",
"url": "https://api.github.com/repos/octocat/Hello-World/keys/1",
"title": "octocat@octomac",
"verified": true,
"created_at": "2014-12-10T15:53:42Z",
"read_only": true,
"added_by": "octocat",
"last_used": "2022-01-10T15:53:42Z",
"enabled": true
}
Get a deploy key
"Get a deploy key"에 대한 세분화된 액세스 토큰
이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:
세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:
- "Administration" repository permissions (read)
"Get a deploy key"에 대한 매개 변수
속성, 형식, 설명 |
---|
accept string Setting to |
속성, 형식, 설명 |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
key_id integer RequiredThe unique identifier of the key. |
"Get a deploy key"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
404 | Resource not found |
"Get a deploy key"에 대한 코드 샘플
요청 예제
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/keys/KEY_ID
Response
Status: 200
{
"id": 1,
"key": "ssh-rsa AAA...",
"url": "https://api.github.com/repos/octocat/Hello-World/keys/1",
"title": "octocat@octomac",
"verified": true,
"created_at": "2014-12-10T15:53:42Z",
"read_only": true,
"added_by": "octocat",
"last_used": "2022-01-10T15:53:42Z",
"enabled": true
}
Delete a deploy key
Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.
"Delete a deploy key"에 대한 세분화된 액세스 토큰
이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:
세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:
- "Administration" repository permissions (write)
"Delete a deploy key"에 대한 매개 변수
속성, 형식, 설명 |
---|
accept string Setting to |
속성, 형식, 설명 |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
key_id integer RequiredThe unique identifier of the key. |
"Delete a deploy key"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
204 | No Content |
"Delete a deploy key"에 대한 코드 샘플
요청 예제
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/keys/KEY_ID
Response
Status: 204