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

Git Blob

REST API를 사용하여 리포지토리에 각 파일의 콘텐츠를 저장하는 데 사용되는 개체 형식인 Git Blob(이진 큰 개체)과 상호 작용합니다.

Git Blob 정보

Git BLOB(Binary Large Object)은 각 파일의 콘텐츠를 리포지토리에 저장하는 데 사용되는 개체 형식입니다. 파일의 SHA-1 해시는 계산되어 BLOB 개체에 저장됩니다. 엔드포인트를 사용하면 GitHub AE에서 Git 데이터베이스에 BLOB 개체를 읽고 쓸 수 있습니다. BLOB은 사용자 지정 미디어 유형을 활용합니다. API에서 미디어 유형의 사용에 대한 자세한 내용은 여기를 참조하세요.

BLOB에 대한 사용자 지정 미디어 유형

다음은 BLOB에 대해 지원되는 미디어 유형입니다.

application/json
application/vnd.github.raw

자세한 내용은 "미디어 유형"을 참조하세요.

Create a blob

에서 작동 GitHub Apps

"Create a blob"에 대한 매개 변수

헤더
속성, 형식, 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
content string 필수

The new blob's content.

encoding string

The encoding used for content. Currently, "utf-8" and "base64" are supported.

기본값: utf-8

"Create a blob"에 대한 HTTP 응답 상태 코드

상태 코드Description
201

Created

403

Forbidden

404

Resource not found

409

Conflict

422

Validation failed, or the endpoint has been spammed.

"Create a blob"에 대한 코드 샘플

post/repos/{owner}/{repo}/git/blobs
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/git/blobs \ -d '{"content":"Content of the blob","encoding":"utf-8"}'

Response

Status: 201
{ "url": "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" }

Get a blob

에서 작동 GitHub Apps

The content in the response will always be Base64 encoded.

Note: This API supports blobs up to 100 megabytes in size.

"Get a blob"에 대한 매개 변수

헤더
속성, 형식, 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.

file_sha string 필수

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

상태 코드Description
200

OK

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

"Get a blob"에 대한 코드 샘플

get/repos/{owner}/{repo}/git/blobs/{file_sha}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/git/blobs/FILE_SHA

Response

Status: 200
{ "content": "Q29udGVudCBvZiB0aGUgYmxvYg==", "encoding": "base64", "url": "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", "size": 19, "node_id": "Q29udGVudCBvZiB0aGUgYmxvYg==" }