{"meta":{"title":"gitignore 用 REST API エンドポイント","intro":"REST API を使用して、ファイルとディレクトリを無視するために使用できる .gitignore テンプレートを取得します。","product":"REST API","breadcrumbs":[{"href":"/ja/rest","title":"REST API"},{"href":"/ja/rest/gitignore","title":"Gitignore"},{"href":"/ja/rest/gitignore/gitignore","title":"Gitignore"}],"documentType":"article"},"body":"# gitignore 用 REST API エンドポイント\n\nREST API を使用して、ファイルとディレクトリを無視するために使用できる .gitignore テンプレートを取得します。\n\n## gitignore について\n\nAPI を介して GitHub で新しいリポジトリを作成するとき、[.gitignore テンプレート](/ja/get-started/git-basics/ignoring-files)を指定して作成時にリポジトリに適用できます。 REST API を使って、GitHub [.gitignore リポジトリ](https://github.com/github/gitignore)から .gitignore テンプレートを取得できます。\n\n> \\[!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## Get all gitignore templates\n\n```\nGET /gitignore/templates\n```\n\nList all templates available to pass as an option when creating a repository.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/gitignore/templates\n```\n\n**Response schema (Status: 200):**\n\nArray of string\n\n## Get a gitignore template\n\n```\nGET /gitignore/templates/{name}\n```\n\nGet the content of a gitignore template.\nThis endpoint supports the following custom media types. For more information, see \"Media types.\"\n\napplication/vnd.github.raw+json: Returns the raw .gitignore contents.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`name`** (string) (required)\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/gitignore/templates/NAME\n```\n\n**Response schema (Status: 200):**\n\n* `name`: required, string\n* `source`: required, string"}