> For the complete documentation index, see [llms.txt](https://docs.groundcover.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.groundcover.com/collect-data/ci-cd-integrations/source-control-gitlab-github.md).

# Adding Source control context

Enrich traces with relevant source control metadata.

groundcover can integrate with your git repository, giving you more context when analyzing your workloads.

By enabling git integration, workload traces will be enriched with the workload's commit hash, and with a link to the commit in your git repository.

Currently, groundcover supports Github and Gitlab.

## How to use

The integration requires 2 steps:

1. Adding annotations to spec of pods
2. Providing installation overrides describing the chosen annotation names

{% hint style="info" %}
We will be using 2 annotations - **Commit Hash** and **Remote Repository URL.**

Note that the commit hash can also be specified as a label. However, due to Kubernetes restrictions on labels patterns, the repository URL must be added as an annotation.
{% endhint %}

{% hint style="info" %}
The names of the annotations do not matter, but make sure to keep them consistent between the two parts. The names are referenced below as **COMMIT\_HASH\_KEY\_NAME** and **FULL\_REPO\_URL\_NAME.**\
\
In our example we will be using:\
COMMIT\_HASH\_KEY\_NAME -> "GITHUB\_COMMIT\_HASH"\
FULL\_REPO\_URL\_NAME -> "GITHUB\_REPO\_URL"
{% endhint %}

### Step 1 - Adding the annotations

Add the following annotations to the pod template spec:

```bash
<COMMIT_HASH_KEY_NAME>: <COMMIT_HASH>
<FULL_REPO_URL_NAME>: <FULL_REPO_URL>

## example
GITHUB_COMMIT_HASH: 6b14c88
GITHUB_REPO_URL: https://github.com/groundcover-com/cli
```

### Step 2 - Providing installation overrides

#### Using CLI

When using CLI it's possible to provide the values directly from the command line:

<pre class="language-bash"><code class="lang-bash">groundcover deploy \
<strong>    --git-commit-hash-key-name &#x3C;COMMIT_HASH_KEY_NAME> \
</strong>    --git-repository-url-key-name &#x3C;FULL_REPO_URL_NAME>

## example
groundcover deploy \
    --git-commit-hash-key-name "GITHUB_COMMIT_HASH" \
    --git-repository-url-key-name "GITHUB_REPO_URL"
</code></pre>

#### Using Helm

When using Helm the values will be passed as overrides in the `values.yaml` file:

```yaml
commitHashKeyName: <COMMIT_HASH_KEY_NAME>
repositoryUrlKeyName: <FULL_REPO_URL_NAME>
 
## example
commitHashKeyName: "GITHUB_COMMIT_HASH"
repositoryUrlKeyName: "GITHUB_REPO_URL"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.groundcover.com/collect-data/ci-cd-integrations/source-control-gitlab-github.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
