# What is Git?

Git repositories served by {{product}}, with pull requests, reviews, branch protection, deploy keys and webhooks.

You find it under **Git** in the Deutsche Cloud Console. Push over HTTPS with an access token or over SSH with
a key from your account; the platform's CI reads the same repositories, so a workflow in a
repository runs without connecting anything.

## When to use it

- You want your code, its reviews and its CI in the same place as the infrastructure it deploys to.
- You are moving off GitHub or GitLab: an import brings history, branches, tags, pull requests and
  the wiki, and a mirror can keep following the source while you switch over.
- You want a second copy of a GitHub repository that you can still build from when one side is
  down (a push mirror).

## Concepts

| Term                  | Meaning                                                                                                                                                                                                                  |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Repository**        | A Git repository owned by your organization, addressed as `<organization>/<repository>`.                                                                                                                                 |
| **Visibility**        | `private`: those whose IAM policies allow it; `public`: anyone can clone it without credentials (see [Public repositories](public-repositories.md)). Older repositories may show `internal`, which behaves as `private`. |
| **Default branch**    | The branch pull requests target unless told otherwise. `main`, unless you name another at creation.                                                                                                                      |
| **Access token**      | A credential for HTTPS. Shown once when created; optional expiry.                                                                                                                                                        |
| **Deploy key**        | An SSH public key that grants a machine access to one repository, read-only unless you say otherwise.                                                                                                                    |
| **Branch protection** | A rule matching a branch pattern that constrains what may land on it and how.                                                                                                                                            |
| **Pull request**      | A proposed merge of one branch into another, with reviews, comments, checks and an approval count.                                                                                                                       |
| **Merge queue**       | A line of pull requests that are tested together on top of a branch before it moves.                                                                                                                                     |
| **Webhook**           | A URL the platform calls when something happens in the repository, such as a push.                                                                                                                                       |

## Repository URLs

| Protocol | URL                                                                      |
| -------- | ------------------------------------------------------------------------ |
| HTTPS    | `https://git.<platform domain>/<organization>/<repository>.git`          |
| SSH      | `ssh://git@git.<platform domain>[:port]/<organization>/<repository>.git` |

The port appears in the SSH URL only when it is not 22. The **Clone** button on a repository shows
both.

## Pricing

You pay for stored repository data: the packfiles of every repository, measured daily and billed
per GB-month. See [Billing](/docs/billing).

## Interfaces

- The Deutsche Cloud Console: **Git → Repositories**.
- The CLI: `dcloud git …`, see `dcloud git repositories list`.
- The HTTP API under `/git/api`, authenticated with a session or an `EWS-ACCESS-KEY` header.
- Terraform: `dcloud_git_repository`, `dcloud_git_branch_protection`, `dcloud_git_tag_protection`,
  `dcloud_git_deploy_key`, `dcloud_git_ssh_key` and `dcloud_git_webhook`.
- Plain `git` over HTTPS and SSH, for clone, fetch and push.

## Next steps

- [Getting started](getting-started.md): create a repository, push to it and merge a pull request.
- [Import a repository](import-a-repository.md) from GitHub, GitLab or any git URL.
