# gitignore에 대한 REST API 엔드포인트

REST API를 사용하고 파일 및 디렉터리를 무시하는 데 사용할 수 있는 .gitignore 템플릿을 가져옵니다.

## gitignore에 대한 정보

API를 통해 GitHub에서 새 리포지토리를 만들 때 생성 시 리포지토리에 적용할 [.gitignore 템플릿](/ko/enterprise-server@3.19/get-started/git-basics/ignoring-files)을 지정할 수 있습니다. REST API를 사용하여 GitHub [.gitignore 리포지토리](https://github.com/github/gitignore)에서 .gitignore 템플릿을 받을 수 있습니다.

> \[!NOTE]
> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2022-11-28`. Curl examples below omit these standard headers for brevity.

## Get all gitignore templates

```
GET /gitignore/templates
```

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

### HTTP response status codes

* **200** - OK

* **304** - Not modified

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/gitignore/templates
```

**Response schema (Status: 200):**

Array of string

## Get a gitignore template

```
GET /gitignore/templates/{name}
```

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.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`name`** (string) (required)

### HTTP response status codes

* **200** - OK

* **304** - Not modified

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/gitignore/templates/NAME
```

**Response schema (Status: 200):**

* `name`: required, string
* `source`: required, string