| title | Gitignore | GitHub API |
|---|
- TOC {:toc}
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.
List all templates available to pass as an option when creating a repository.
GET /gitignore/templates
<%= headers 200 %> <%= json(:templates) %>
The API also allows fetching the source of a single template.
GET /gitignore/templates/C
<%= headers 200 %> <%= json(:template) %>
Use the raw media type to get the raw contents.
<%= headers 200 %>
# Object files *.o # Libraries *.lib *.a # Shared objects (inc. Windows DLLs) *.dll *.so *.so.* *.dylib # Executables *.exe *.out *.app