# Public repositories

A public repository can be cloned by anyone over HTTPS, with no account and no token.

A repository's visibility is `private` or `public`. A private repository is readable only by those
whose IAM policies allow it (`git:PullRepository` to clone). Older repositories may show
`internal`; it is enforced exactly like `private`, and once you move a repository off it, it cannot
be chosen again.

You set the visibility when you create or import a repository (under **Visibility**, choose
**Public**), or later under **Settings → Visibility**, where the choice reads **Public (anyone can
clone it without credentials)**.

## How a public repository behaves

- Anyone can `git clone` and fetch a public repository over HTTPS with no account and no token.
- The GitHub-compatible API (`https://git.<platform domain>/api/v3/…`) also answers reads of a
  public repository without a token.
- Pushing, and every write (pull requests, settings, CI), still needs IAM: pushing needs
  `git:PushRepository`.
- A public repository stays readable with any access token, including one narrowed to other
  repositories.
- Browsing a public repository in the Deutsche Cloud Console still needs signing in to your organization.

## Who may make a repository public

Making a repository public, at creation, at import, or by changing its visibility, needs
**`git:PublishRepository`** as well as the usual action (`git:CreateRepository` or
`git:UpdateRepository`). Without it the request is refused with `403`. It is an action of its own,
so a policy can let people manage repositories and still deny publishing in one statement. Making a
public repository private again needs only `git:UpdateRepository`.

## Limits

Anonymous requests to a public repository are limited per address: a burst of 30, then one per
second. A clone is two or three requests. Over that, a clone answers `429` with a `Retry-After`
header and the text `Too many anonymous requests from your address; wait, or authenticate with a
token`. Requests with a token of the repository's organization are not limited this way.

## Related

- [Create a repository](create-a-repository.md)
- [Change repository settings](change-repository-settings.md)
- [Clone over HTTPS](clone-over-https.md)
