--- title: Gitignore intro: >- Use the REST API to get `.gitignore` templates that can be used to ignore files and directories. versions: # DO NOT MANUALLY EDIT. CHANGES WILL BE OVERWRITTEN BY A 🤖 fpt: '*' ghae: '*' ghec: '*' ghes: '*' topics: - API redirect_from: - /rest/reference/gitignore autogenerated: rest --- ## About gitignore When you create a new repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %} via the API, you can specify a [.gitignore template](/get-started/getting-started-with-git/ignoring-files) to apply to the repository upon creation. You can use the REST API to get .gitignore templates from the {% data variables.product.product_name %} [.gitignore repository](https://github.com/github/gitignore). You can use the `application/vnd.github.raw` custom media type when getting a gitignore template. For more information, see "[AUTOTITLE](/rest/overview/media-types)."