# Git accounts

Source: https://openpanel.sh/docs/git

Connect your organization's GitHub, GitLab, Gitea, Forgejo and Bitbucket accounts, or any Git repository over SSH or HTTPS, and how OpenPanel checks and keeps them.

Git accounts are where your services' code comes from. An organization adds as many as it needs, of any kind, and every member sees them. A service built from Git names one of these accounts and a repository it can read, and each deploy clones it with the account's credentials. See [Deploy from Git](/docs/deploy/git).

Most of this page is about the organization's accounts. A member's own Git account is described [below](#a-members-own-git-account).

## Kinds of accounts [#kinds-of-accounts]

| Kind | For | Credentials | Page |
|---|---|---|---|
| **GitHub** | github.com or GitHub Enterprise Server | Personal access token | [GitHub](/docs/git/github) |
| **GitLab** | gitlab.com or your own GitLab | Personal access token | [GitLab](/docs/git/gitlab) |
| **Gitea** | Your own Gitea | Access token | [Gitea and Forgejo](/docs/git/gitea-forgejo) |
| **Forgejo** | Your own Forgejo, or Codeberg | Access token | [Gitea and Forgejo](/docs/git/gitea-forgejo) |
| **Bitbucket** | Bitbucket Cloud | Atlassian account email and API token | [Bitbucket](/docs/git/bitbucket) |
| **Git over SSH** | One repository on any Git server | A deploy key OpenPanel makes | [Any Git server](/docs/git/any-git-server) |
| **Git over HTTPS** | One repository on any Git server | Username and password or token, or none for a public repository | [Any Git server](/docs/git/any-git-server) |

A Git server inside your private network can be reached through it: see [Private Git servers](/docs/network/private-git).

## Add an account [#add-an-account]

<Steps>
<Step>
### Open Git accounts [#open-git-accounts]

In the console, open **Organization settings** and the **Git accounts** tab, and choose **Add Git account**. Only the Owner and Admins can add accounts.
</Step>

<Step>
### Choose the kind [#choose-the-kind]

Choose a tile under **Git services** or **Any Git server**.
</Step>

<Step>
### Fill in the fields [#fill-in-the-fields]

- **Name**: how the account appears in OpenPanel, up to 60 characters. Left empty, it is named after the address.
- **Address** or **Repository URL**, where the kind needs one.
- **Reached through the private network**, for a Git server inside your private network.
- The token, password or email the kind asks for. The dialog links to the page where the token is made, and names the scopes to tick.
</Step>

<Step>
### Add it [#add-it]

Choose **Add account** (or **Make the key** for Git over SSH). OpenPanel checks the account straight away:

- **GitHub, GitLab, Gitea, Forgejo and Bitbucket** accounts are saved only when the check passes. If it fails, the console says why and "Nothing was saved."
- **Git over HTTPS** is checked the same way.
- **Git over SSH** is saved with its new deploy key even before the host accepts it, because you can add the key to the repository only afterwards.
- An account **reached through the private network** with no ready server to check from is saved as **Not checked**.
</Step>
</Steps>

## The list [#the-list]

Each account shows its name and kind, a **Private network** tag if it is reached that way, the login and picture of the token's user (or the repository URL), and what the last check found, for example "12 repositories" or "Default branch main · 14 refs".

| State | What it means |
|---|---|
| **Working** | The last check passed. |
| **Failed** | The last check failed. The reason is shown under the account. |
| **Waiting** | Checked, but waiting for you: add the deploy key to the repository, then check again. |
| **Not checked** | Never checked, for example because no server was ready to check from. |

| Action | Who |
|---|---|
| **Repositories** (or **Branches** for a one-repository account): what the account can read, most recently updated first | Every member |
| **Check again** | Owner and Admins |
| **Rename**: only the name in OpenPanel changes | Owner and Admins |
| **Deploy key**: shows a Git over SSH account's public key again | Owner and Admins |
| **Remove** | Owner and Admins |

To change an account's token or password, remove the account and add it again.

## Use an account for a service [#use-an-account-for-a-service]

A service names the account by its ID. List the organization's accounts with their IDs:

<Tabs items={["CLI","API"]}>
<Tab value="CLI">
```sh
openpanel git
```

```text
LABEL             PROVIDER  URL                             STATUS  ID
git/git (public)  https     https://github.com/git/git.git  ok      508f98d2-cfa4-4f8f-a2f9-d8e4a4225a08
```
</Tab>

<Tab value="API">
```sh
curl https://openpanel.sh/api/v1/git-accounts \
  -H "Authorization: Bearer $OPENPANEL_TOKEN"
```
</Tab>
</Tabs>

Then give a service the account, the repository and the branch, for example `openpanel services create web --project shop --repo acme/web --git-account <id> --branch main`. See [Deploy from Git](/docs/deploy/git). To deploy on every push, see [Push to deploy](/docs/deploy/push-to-deploy).

When a deploy clones the repository, the account's token, password or key travels to the server sealed, and is opened only on its way to the agent that builds. See [How builds work](/docs/builds).

## How OpenPanel keeps them [#how-openpanel-keeps-them]

- **Tokens, passwords and private keys are encrypted** as soon as they arrive, and never shown again, not even to an Admin. The only thing shown again is a Git over SSH account's public deploy key.
- **Requests from OpenPanel go only to public addresses.** A host that resolves to a private address is refused, with a hint to use the private network. Requests follow no redirects and stop after 10 seconds.
- **SSH host keys are pinned** at the first check. A Git server that later answers with another key is refused.
- **Checks are limited** to ten per organization in ten minutes, and repository lists to thirty, so the page cannot be used to hammer a host or try tokens.

## A member's own Git account [#a-members-own-git-account]

Besides the organization's accounts, each member who can deploy may add Git accounts of their own, for repositories that are theirs rather than the organization's, such as their own GitHub account. They are listed under **Your own accounts** on the **Git accounts** tab.

- **Add one** with **Add your own account**: the same kinds and fields as above.
- **Only its owner** sees it and can choose it for a service. When they add a service from Git, it appears marked **Yours** in the account list.
- **A service set up with one keeps it** when someone else changes the service's other settings, and its deploys use it. It builds only a repository its owner chose.
- **It is deleted** when its owner leaves or is removed from the organization, with the token OpenPanel held for it.

Members who can only view the organization cannot add one. The API and the CLI list Git accounts but do not add them, and their list shows the organization's accounts only.

## Remove an account [#remove-an-account]

In the account's menu, choose **Remove** and confirm. OpenPanel forgets the account and deletes what it kept encrypted. Nothing changes at the Git service: revoke the token there too if nothing else uses it, or remove the deploy key from the repository so it stops working.