---
title: "Get a reference"
method: GET
path: "/repos/{owner}/{repo}/git/ref/{ref}"
tags: ["git"]
---

# Get a reference

`GET /repos/{owner}/{repo}/git/ref/{ref}`

Returns a single reference from your Git database. The `:ref` in the URL must be formatted as `heads/<branch name>` for branches and `tags/<tag name>` for tags. If the `:ref` doesn't match an existing ref, a `404` is returned.

> [!NOTE]
> You need to explicitly [request a pull request](https://docs.github.com/rest/pulls/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)".

## Path parameters

- `owner` string, required
- `repo` string, required
- `ref` string, required

## Response `200`

Response

- GitRef — Git references within a repository
  - `ref` string, required
  - `node_id` string, required
  - `url` string, uri, required
  - `object` object, required
    - `type` string, required
    - `sha` string, required — SHA for the reference
    - `url` string, uri, required

## Other responses

- `404` — Resource not found
- `409` — Conflict

---

[API](https://skmtc.net/github/apis/rest-api.md) · [All operations](https://skmtc.net/github/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest-api/versions/80850db290cd/schema)
