When you create a new GitHub repository via the API, you can specify a .gitignore template to apply to the repository upon creation. The .gitignore Templates API lists and fetches templates from the GitHub .gitignore repository.

Listing available templates

List all templates available to pass as an option when creating a repository.

GET /gitignore/templates


Status: 200 OK

Get a single template

The API also allows fetching the source of a single template.

GET /gitignore/templates/:name


Status: 200 OK
  "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"

Use the raw media type to get the raw contents.

Status: 200 OK
# Object files

# Libraries

# Shared objects (inc. Windows DLLs)

# Executables