# Connection Info as code

> Synchronize Connection Info and attached auth plugins with a remote source code repository

---

Site [llms.txt](/llms.txt)

---

You can push a [Connection Info](/docs/cmp/configure/integrations/connection-info/) to a repository, preview the changes, and refresh it from the repository. You can also create a Connection Info from one in a repository, for example, to copy it to another Cloud Management Platform (CMP) instance. You need a [repository linked to CMP](/docs/cmp/configure/integrations/source-code-repository/#link-a-remote-repository). To push, you also need [repository credentials on your profile](/docs/cmp/configure/integrations/source-code-repository/#configure-repository-credentials), unless the repository uses [GitHub App authentication](/docs/cmp/configure/integrations/source-code-repository/github-app-authentication/).

## What CMP stores in the repository

Each Connection Info gets its own folder, `connection_infos/<global ID>/`, holding `<global ID>_metadata.json`. The file has the Connection Info's global ID, name, host, port, protocol, username, description, and whether it uses authentication headers.

The password, the authentication headers, and any token from an auth plugin never reach the repository.

If the Connection Info has an [auth plugin](/docs/cmp/configure/integrations/connection-info-auth-plugins/), CMP pushes the plugin with it, to `plugins/<plugin global ID>/`.

## Push and refresh a Connection Info

Go to **Admin** > **Connection Info**, select the Connection Info's name, then select its **Repository** tab.

**Push to Remote Source** opens a form for a **Repository**, **Branch**, and **Commit Message**. For **Branch**, select an existing branch or enter the name of a new one. If the Connection Info has been pushed before, select **Preview** to see what changed.

**Refresh from Remote Source** appears once the Connection Info has been pushed or created from a repository. It prompts for a **Repository** and **Branch**, then updates the Connection Info and its auth plugin in CMP. CMP keeps the stored password, headers, and token.

Nothing is pushed or refreshed automatically.

## Create a Connection Info from a repository

1. Go to **Admin** > **Connection Info**.
1. Select **Create from Repository**.
1. Provide a **Repository**, **Branch**, and **Connection Info JSON File**. The list shows the `_metadata.json` files in the repository's `connection_infos/` folder.
1. Select **Create**.

The new Connection Info has no password or headers. Edit it to add them before you use it. If CMP already has a Connection Info with the same global ID, creation fails with an error, and the existing Connection Info isn't changed.

## Related

- [Integrate a remote source code repository](/docs/cmp/configure/integrations/source-code-repository/): Linking a repository and setting credentials for your commits.
- [Connection Info auth plugins](/docs/cmp/configure/integrations/connection-info-auth-plugins/): Logging in to APIs that issue short-lived tokens.
