> ## Documentation Index
> Fetch the complete documentation index at: https://checkly-422f444a-mintlify-b40fd0ef.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Attaching Git metadata

> Attach git metadata like branch, commit SHA, and owner to your Checkly test sessions and deployments so you can cross-reference monitoring with code changes.

The CLI can attach git metadata like `branch`, `commit sha`, `owner` and more when executing the `test --record` and `deploy` commands. This way you can keep track of
your test sessions and deployed resources in the UI and cross-reference them with any updates to your code.

For example, in the screenshot below we ran a **test session** from our CI server after the project was deployed to our
Staging environment with the `npx checkly test` command.

<img src="https://mintcdn.com/checkly-422f444a-mintlify-b40fd0ef/QuoVl5uLwfhYTrsa/images/docs/images/cli/test_session_git_data.png?fit=max&auto=format&n=QuoVl5uLwfhYTrsa&q=85&s=0aa9c2f5ecafc52a70791e02ee37cef2" alt="test session with git info" width="1970" height="811" data-path="images/docs/images/cli/test_session_git_data.png" />

After the test succeeds, we **deploy** this check so it runs as a monitor with `npx checkly deploy`.

<img src="https://mintcdn.com/checkly-422f444a-mintlify-b40fd0ef/QuoVl5uLwfhYTrsa/images/docs/images/cli/browser_check_git_data.png?fit=max&auto=format&n=QuoVl5uLwfhYTrsa&q=85&s=e07b8f366d92bc9a148a0a399ee5369e" alt="browser check with git info" width="2252" height="775" data-path="images/docs/images/cli/browser_check_git_data.png" />

## Environment variables

The CLI will attempt to auto-detect and parse git specific information from your local machine or CI environment, but you
can also set these data items specifically by using environment variables.

| Item               | Auto  | Variable                                               | Description                                 |
| ------------------ | ----- | ------------------------------------------------------ | ------------------------------------------- |
| **Repository**     | false | `repoUrl` in `checkly.config.ts` or `CHECKLY_REPO_URL` | The URL of your repo on GitHub, GitLab etc. |
| **Commit hash**    | true  | `CHECKLY_REPO_SHA`                                     | The SHA of the commit.                      |
| **Branch**         | true  | `CHECKLY_REPO_BRANCH`                                  | The branch name.                            |
| **Commit owner**   | true  | `CHECKLY_REPO_COMMIT_OWNER`                            | The committer's name or email.              |
| **Commit message** | true  | `CHECKLY_REPO_COMMIT_MESSAGE`                          | The commit message.                         |
| **Environment**    | false | `CHECKLY_TEST_ENVIRONMENT`                             | The environment name, e.g. "staging"        |

For example, if you want to specifically set the Environment you invoke:

```bash Terminal theme={null}
CHECKLY_TEST_ENVIRONMENT=Production npx checkly test
```

Or, if you want to set repo URL you invoke:

```bash Terminal theme={null}
CHECKLY_REPO_URL="https://my.git.solution/project/" npx checkly test
```

## Working with multiple repositories

Each `checkly test --record` or `checkly deploy` invocation attaches metadata for a **single** `repoUrl`. If your monitors span multiple source repositories (for example, a backend repo and a frontend repo), run the CLI separately from each repository's CI pipeline and set `CHECKLY_REPO_URL` (and the other git variables) to point at the repo that owns the checks being tested or deployed in that pipeline.

```bash Terminal theme={null}
# Backend CI pipeline
CHECKLY_REPO_URL="https://github.com/acme/backend" npx checkly deploy

# Frontend CI pipeline
CHECKLY_REPO_URL="https://github.com/acme/frontend" npx checkly deploy
```

To keep checks from different repos isolated, scope each pipeline to its own set of resources — for example by placing each repo's checks in a separate [group](/platform/groups) or by using the [`--tags`](/cli/checkly-deploy) and check-file globs in `checkly.config` so that a deploy from one repo only touches its own checks.
