Skip to main content
설명서에 자주 업데이트를 게시하며 이 페이지의 번역이 계속 진행 중일 수 있습니다. 최신 정보는 영어 설명서를 참조하세요.

키 배포

REST API를 사용하여 배포 키를 만들고 관리합니다.

키 배포 정보

단일 리포지토리에 대한 액세스 권한을 부여하는 SSH 키인 배포 키를 사용하여 GitHub Enterprise Server 인스턴스의 리포지토리에서 프로젝트를 시작할 수 있습니다. GitHub Enterprise Server는 키의 퍼블릭 부분을 개인 계정 대신 리포지토리에 직접 연결하고 키의 프라이빗 부분은 서버에 남아 있습니다. 자세한 내용은 "배포 제공"을 참조하세요.

배포 키는 다음 API 엔드포인트를 사용하거나 GitHub를 사용하여 설정할 수 있습니다. GitHub에서 배포 키를 설정하는 방법을 알아보려면 "배포 키 관리"을 참조하세요.

List deploy keys

에서 작동 GitHub Apps

"List deploy keys"에 대한 매개 변수

헤더
속성, 형식, Description
accept string

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

경로 매개 변수
속성, 형식, Description
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.

쿼리 매개 변수
속성, 형식, Description
per_page integer

The number of results per page (max 100).

기본값: 30

page integer

Page number of the results to fetch.

기본값: 1

"List deploy keys"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

"List deploy keys"에 대한 코드 샘플

get/repos/{owner}/{repo}/keys
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/keys

Response

Status: 200
[ { "id": 1, "key": "ssh-rsa AAA...", "url": "https://HOSTNAME/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" } ]

Create a deploy key

에서 작동 GitHub Apps

You can create a read-only deploy key.

"Create a deploy key"에 대한 매개 변수

헤더
속성, 형식, Description
accept string

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

경로 매개 변수
속성, 형식, Description
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.

본문 매개 변수
속성, 형식, Description
title string

A name for the key.

key string 필수

The contents of the key.

read_only boolean

If true, the key will only be able to read repository contents. Otherwise, the key will be able to read and write.

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 응답 상태 코드

상태 코드Description
201

Created

422

Validation failed, or the endpoint has been spammed.

"Create a deploy key"에 대한 코드 샘플

post/repos/{owner}/{repo}/keys
curl -L \ -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://HOSTNAME/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" }

Get a deploy key

에서 작동 GitHub Apps

"Get a deploy key"에 대한 매개 변수

헤더
속성, 형식, Description
accept string

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

경로 매개 변수
속성, 형식, Description
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.

"Get a deploy key"에 대한 HTTP 응답 상태 코드

상태 코드Description
200

OK

404

Resource not found

"Get a deploy key"에 대한 코드 샘플

get/repos/{owner}/{repo}/keys/{key_id}
curl -L \ -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://HOSTNAME/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" }

Delete a deploy key

에서 작동 GitHub Apps

Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.

"Delete a deploy key"에 대한 매개 변수

헤더
속성, 형식, Description
accept string

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

경로 매개 변수
속성, 형식, Description
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.

"Delete a deploy key"에 대한 HTTP 응답 상태 코드

상태 코드Description
204

No Content

"Delete a deploy key"에 대한 코드 샘플

delete/repos/{owner}/{repo}/keys/{key_id}
curl -L \ -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