이제 REST API의 버전이 지정되었습니다. 자세한 내용은 "API 버전 관리 정보"를 참조하세요.
gitignore
REST API를 사용하고 파일 및 디렉터리를 무시하는 데 사용할 수 있는 .gitignore
템플릿을 가져옵니다.
gitignore 정보
API를 통해 GitHub.com에서 새 리포지토리를 만들 때 생성 시 리포지토리에 적용할 .gitignore 템플릿을 지정할 수 있습니다. REST API를 사용하여 GitHub .gitignore 리포지토리에서 .gitignore 템플릿을 받을 수 있습니다.
gitignore 템플릿을 가져오는 경우 application/vnd.github.raw
사용자 지정 미디어 유형을 사용할 수 있습니다. 자세한 내용은 "미디어 유형"을 참조하세요.
Get all gitignore templates
Works with GitHub Apps
List all templates available to pass as an option when creating a repository.
"Get all gitignore templates"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
304 | Not modified |
"Get all gitignore templates"에 대한 코드 샘플
get/gitignore/templates
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/gitignore/templates
Response
Get a gitignore template
Works with GitHub Apps
The API also allows fetching the source of a single template. Use the raw media type to get the raw contents.
"Get a gitignore template"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
name string Required |
"Get a gitignore template"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
304 | Not modified |
"Get a gitignore template"에 대한 코드 샘플
get /gitignore /templates /{name}
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/gitignore/templates/NAME
Response