> 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/~/revisions/ETrLpNk6KtHjyaVUTLoE/integrations/source-control-gitlab-github.md).

# Source control (Gitlab/Github)

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

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

&#x20;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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.groundcover.com/~/revisions/ETrLpNk6KtHjyaVUTLoE/integrations/source-control-gitlab-github.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
