키 배포
REST API를 사용하여 배포 키를 만들고 관리합니다.
배포 키 정보
단일 리포지토리에 대한 액세스 권한을 부여하는 SSH 키인 배포 키를 사용하여 GitHub Enterprise Server 인스턴스의 리포지토리에서 프로젝트를 시작할 수 있습니다. GitHub Enterprise Server는 키의 퍼블릭 부분을 개인 계정 대신 리포지토리에 직접 연결하고 키의 프라이빗 부분은 서버에 남아 있습니다. 자세한 내용은 “배포 제공”을 참조하세요.
배포 키는 다음 API 엔드포인트를 사용하거나 GitHub를 사용하여 설정할 수 있습니다. GitHub에서 배포 키를 설정하는 방법을 알아보려면 “배포 키 관리”를 참조하세요.
List deploy keys
매개 변수
헤더 |
---|
이름, Type, 설명 |
accept stringSetting to |
경로 매개 변수 |
이름, Type, 설명 |
owner string필수The account owner of the repository. The name is not case sensitive. |
repo string필수The name of the repository. The name is not case sensitive. |
쿼리 매개 변수 |
이름, Type, 설명 |
per_page integerThe number of results per page (max 100). 기본값: |
page integerPage number of the results to fetch. 기본값: |
HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
200 | OK |
코드 샘플
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/keys
Response
Status: 200
{}
Create a deploy key
You can create a read-only deploy key.
매개 변수
헤더 |
---|
이름, Type, 설명 |
accept stringSetting to |
경로 매개 변수 |
이름, Type, 설명 |
owner string필수The account owner of the repository. The name is not case sensitive. |
repo string필수The name of the repository. The name is not case sensitive. |
본문 매개 변수 |
이름, Type, 설명 |
title stringA name for the key. |
key string필수The contents of the key. |
read_only booleanIf 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." |
HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
201 | Created |
422 | Validation failed, or the endpoint has been spammed. |
코드 샘플
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/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
}
Get a deploy key
매개 변수
헤더 |
---|
이름, Type, 설명 |
accept stringSetting to |
경로 매개 변수 |
이름, Type, 설명 |
owner string필수The account owner of the repository. The name is not case sensitive. |
repo string필수The name of the repository. The name is not case sensitive. |
key_id integer필수The unique identifier of the key. |
HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
200 | OK |
404 | Resource not found |
코드 샘플
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/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
}
Delete a deploy key
Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.
매개 변수
헤더 |
---|
이름, Type, 설명 |
accept stringSetting to |
경로 매개 변수 |
이름, Type, 설명 |
owner string필수The account owner of the repository. The name is not case sensitive. |
repo string필수The name of the repository. The name is not case sensitive. |
key_id integer필수The unique identifier of the key. |
HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
204 | No Content |
코드 샘플
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/keys/KEY_ID
Response
Status: 204