---
title: "Get branches for a public repository (supports GitHub and GitLab)"
method: GET
path: "/git/public/{provider}/{owner}/{repo}/branches"
tags: ["Public Repositories"]
---

# Get branches for a public repository (supports GitHub and GitLab)

`GET /git/public/{provider}/{owner}/{repo}/branches`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/git/public/{provider}/{owner}/{repo}/branches`
- Auth: none declared

## Path parameters

- `provider` string, required
- `owner` string, required
- `repo` string, required

## Query parameters

- `base_url` string, nullable
- `fresh` boolean

## Response `200`

List of branches

- BranchListResponse
  - `branches` BranchInfo[], required
    - `commit_sha` string, required
    - `is_default` boolean, required: Whether this is the repository's default branch, as reported by the git provider (e.g. `main` or `master`). Clients should use this instead of guessing from the branch name.
    - `name` string, required
    - `protected` boolean, required

## Other responses

- `400`: Provider not supported
- `401`: Authentication required for custom GitLab origins
- `403`: Git provider permission required
- `404`: Repository not found
- `429`: API rate limit exceeded
- `500`: Internal server error

## Changes

- **2026-09-11** `0597896e6540`: 1 info
  - added the required property `branches/items/is_default` to the response with the `200` status
- **2026-09-11** `8b0ca7a1320f`: 1 breaking
  - removed the required property `branches/items/is_default` from the response with the `200` status
- **2026-09-09** `961c884b4940`: 1 info
  - added the required property `branches/items/is_default` to the response with the `200` status
- **2026-09-07** `2a40922f832c`: 2 info
  - added the new optional `query` request parameter `base_url`
  - added the non-success response with the status `401`
- **2026-09-07** `38e97c3c35dd`: 1 info
  - added the non-success response with the status `403`

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/git/public/:provider/:owner/:repo/branches/get.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
