gitignore
REST API를 사용하여 파일 및 디렉터리를 무시하는 데 사용할 수 있는 템플릿을 가져옵니다 .gitignore .
gitignore 정보
GitHub AE에서 API를 통해 새 리포지토리를 만들 때 .gitignore 템플릿 을 지정하여 리포지토리에 적용할 수 있습니다. REST API를 사용하여 GitHub AE .gitignore 리포지토리에서 .gitignore 템플릿을 가져올 수 있습니다.
gitignore 템플릿을 application/vnd.github.raw 가져오는 경우 사용자 지정 미디어 형식을 사용할 수 있습니다. 자세한 내용은 “미디어 유형”을 참조하세요.
Get all gitignore templates
에서 작동 GitHub Apps
List all templates available to pass as an option when creating a repository.
HTTP 응답 상태 코드
| 상태 코드 | Description |
|---|---|
200 | OK |
304 | Not modified |
코드 샘플
get/gitignore/templates
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/gitignore/templatesResponse
Status: 200[
"Actionscript",
"Android",
"AppceleratorTitanium",
"Autotools",
"Bancha",
"C",
"C++"
]Get a gitignore template
에서 작동 GitHub Apps
The API also allows fetching the source of a single template. Use the raw media type to get the raw contents.
매개 변수
| 헤더 |
|---|
| 이름, Type, 설명 |
acceptstringSetting to |
| 경로 매개 변수 |
| 이름, Type, 설명 |
namestring필수 |
HTTP 응답 상태 코드
| 상태 코드 | Description |
|---|---|
200 | OK |
304 | Not modified |
코드 샘플
get /gitignore /templates /{name}
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/gitignore/templates/NAMEResponse
Status: 200{
"name": "C",
"source": "# Object files\n*.o\n\n# Libraries\n*.lib\n*.a\n\n# Shared objects (inc. Windows DLLs)\n*.dll\n*.so\n*.so.*\n*.dylib\n\n# Executables\n*.exe\n*.out\n*.app\n"
}