HTTP/2 301
access-control-allow-origin: *
content-security-policy: default-src 'none';prefetch-src 'self';connect-src 'self';font-src 'self' data:;img-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com data: placehold.it;object-src 'self';script-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' data: 'unsafe-inline';script-src-attr 'self';frame-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com https://support.github.com https://www.youtube-nocookie.com;frame-ancestors 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com;style-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' 'unsafe-inline' data:;child-src 'self';manifest-src 'self';upgrade-insecure-requests;base-uri 'self';form-action 'self'
cross-origin-opener-policy: same-origin
cross-origin-resource-policy: same-origin
origin-agent-cluster: ?1
referrer-policy: no-referrer-when-downgrade
x-content-type-options: nosniff
x-dns-prefetch-control: off
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-xss-protection: 0
cache-control: public, max-age=60
location: /en/rest/gitignore/gitignore
content-type: text/plain; charset=utf-8
x-github-backend: Kubernetes
x-github-request-id: B318:3B8038:2067571:2EE8B6D:695190E8
accept-ranges: bytes
age: 0
date: Sun, 28 Dec 2025 20:19:53 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210075-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1766953193.597886,VS0,VE953
vary: Accept
strict-transport-security: max-age=31557600
content-length: 62
HTTP/2 200
access-control-allow-origin: *
content-security-policy: default-src 'none';prefetch-src 'self';connect-src 'self';font-src 'self' data:;img-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com data: placehold.it;object-src 'self';script-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' data: 'unsafe-inline';script-src-attr 'self';frame-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com https://support.github.com https://www.youtube-nocookie.com;frame-ancestors 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com;style-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' 'unsafe-inline' data:;child-src 'self';manifest-src 'self';upgrade-insecure-requests;base-uri 'self';form-action 'self'
cross-origin-opener-policy: same-origin
cross-origin-resource-policy: same-origin
origin-agent-cluster: ?1
referrer-policy: no-referrer-when-downgrade
x-content-type-options: nosniff
x-dns-prefetch-control: off
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-xss-protection: 0
cache-control: public, max-age=60
x-powered-by: Next.js
content-type: text/html; charset=utf-8
x-github-backend: Kubernetes
x-github-request-id: B001:22C775:1E5009C:2CDE3AF:695190E9
content-encoding: gzip
accept-ranges: bytes
age: 1
date: Sun, 28 Dec 2025 20:19:55 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210075-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1766953194.564875,VS0,VE2044
vary: Accept-Encoding
strict-transport-security: max-age=31557600
content-length: 26939
REST API endpoints for gitignore - GitHub Docs Skip to main content REST API endpoints for gitignore Use the REST API to get .gitignore templates that can be used to ignore files and directories.
When you create a new repository on GitHub via the API, you can specify a .gitignore template to apply to the repository upon creation. You can use the REST API to get .gitignore templates from the GitHub .gitignore repository .
This endpoint works with the following fine-grained token types:
The fine-grained token does not require any permissions.
This endpoint can be used without authentication if only public resources are requested.
Status code Description 200304
Request example Copy to clipboard curl request example curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/gitignore/templates
Response
Example response
Response schema
Status: 200
[
"Actionscript",
"Android",
"AppceleratorTitanium",
"Autotools",
"Bancha",
"C",
"C++"
]
Get the content of a gitignore template.
This endpoint supports the following custom media types. For more information, see "Media types ."
application/vnd.github.raw+json : Returns the raw .gitignore contents.
This endpoint works with the following fine-grained token types:
The fine-grained token does not require any permissions.
This endpoint can be used without authentication if only public resources are requested.
Headers Name, Type, Description accept string
Setting to application/vnd.github+json is recommended.
Path parameters Name, Type, Description
Status code Description 200304
Request example get /gitignore /templates /{name}
Copy to clipboard curl request example curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/gitignore/templates/NAME
Response
Example response
Response schema
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"
}