---
title: "Git Access and Policy History"
description: "See whether Nirmata Control Hub can reach the GitLab repository of a Policy Set, which commit last changed each policy, whether that change is deployed, and the commit history of each policy."
diataxis: how-to
applies_to:
  product: "nirmata-control-hub"
audience: ["platform-engineer","devsecops"]
last_updated: 2026-12-01
url: https://docs.nirmata.io/docs/control-hub/policy-hub/policy-sets/git-history/
---


Nirmata Control Hub (NCH) reads the Git repository of a Policy Set directly. For each policy it shows who changed it, when, and why, and whether that change is already running on your clusters. It also shows whether NCH can reach the repository at all.

## Requirements

- The Policy Set is a **Git** Policy Set whose repository is on **GitLab** (gitlab.com or self-hosted).
- The repository type of the Policy Set is `Policies`. Sets with the `Kustomize` or `HelmChart` type, Helm sets, Nirmata curated sets, and sets on github.com don't have Git history. They keep the **Synced Commit** column described in [Limits](#limits).
- A Git provider account exists for the GitLab host of the repository. NCH uses it to read the repository. See [Add a Git provider account]({{< relref "/docs/control-hub/policy-hub/policy-exceptions/git-integration/_index.md#add-a-git-provider-account" >}}). The account can be added even when the tenant uses Automatic deployment for policy exceptions; see [Tenants that use Automatic deployment]({{< relref "/docs/control-hub/policy-hub/policy-exceptions/git-integration/_index.md#tenants-that-use-automatic-deployment" >}}).

When you create or edit a Git Policy Set, admin and platform users can pick the account in the **Git provider account** field. If you leave it empty (**Match by host automatically**), NCH uses an account whose host matches the repository URL.

## Check Git access

The Policy Sets list has a **Git Access** column, and the Policy Set details page shows the same chip in its header. Rows that are not Git sets show `---`. Hover over the chip to see the message of the last check, the Git provider account that was used, and when the check ran.

![Policy Sets list with the Git access column](/images/ps-git-access-list.png)

| State | Meaning |
|---|---|
| **Connected** | NCH can read the repository and open merge requests. |
| **Read-only** | NCH can read the repository but can't open merge requests. History works; editing doesn't. |
| **No access** | NCH can't read the repository. The message says why, for example the token was rejected, the project isn't visible, or there is no account for the host. |
| **Error** | The check couldn't finish because GitLab or the network failed. NCH checks again later on its own. |
| **Not checked** | The repository hasn't been checked yet. |
| **Not applicable** | There is no repository NCH checks: a Helm set, a curated set, a github.com repository, or a set without a repository. |

To check access again, for example after you fixed the token, click **Check access** in the Policy Set header. The button is available to admin and platform users only. The page reloads the Policy Set and shows the new state.

> **Note:** For the editing features in [Edit Policies and Open Merge Requests]({{< relref "/docs/control-hub/policy-hub/policy-sets/edit-policies/_index.md" >}}), the state must be **Connected**. A **Read-only** state usually means the Git provider account needs the Developer role on the project and the `api` scope on its token.

## See when each policy last changed

Open the Policy Set and click the **Deployed Policies** tab. The table has the columns **Name**, **Kind**, **Description**, **Last Changed**, **Clusters Sync Status**, and **Actions**.

![Deployed Policies tab with the Last changed column](/images/ps-git-last-changed.png)

The **Last Changed** column shows:

- On the first line, the short SHA of the commit that last changed the policy's file (a link to the commit), how long ago, and the author. Hover over the SHA to see the commit message.
- On the second line, the deploy state:
  - **Not yet deployed**: the latest change to this policy isn't on your clusters yet, or no cluster runs the policy.
  - **Deployed in `<sha>`**: the clusters run the latest version of the policy.
  - Nothing, when the commit deployed on the clusters isn't known.

The table lists the policies the clusters report together with the policies in the repository:

- A policy that is in the repository but on no cluster appears with **Not yet deployed** and `---` under **Clusters Sync Status**.
- A policy that runs on a cluster but isn't in the repository shows `---` under **Last Changed**.

## Open the policy details drawer

Click a policy name, or click `⋮` > **View** in its row. A drawer opens over the table. Use **Previous** and **Next** to move through the policies in the table's current order, and **Close** to return to the table.

The drawer has three tabs.

### History

The **History** tab lists the 20 newest commits that changed the policy's file. Each commit shows the first line of its message, the short SHA (a link to GitLab), the author, and the time.

- Click **Show N Files** to see the files the commit changed, with the change type (`A` added, `M` modified, `R` renamed, `D` deleted).
- A **Deployed** tag marks the version of the file that your clusters run.
- Click **Show more** to load up to 100 commits. Beyond that, the tab shows "Older history is only available in GitLab".

![History tab of the policy details drawer](/images/ps-git-history-drawer.png)

### YAML

The **YAML** tab shows the policy file from Git, read-only. A label says which version it is:

- **At deployed commit `<sha>`**: the version your clusters run. This is the default.
- **At latest commit `<sha>` (not deployed yet)**: the policy isn't on any cluster yet.
- **At latest commit `<sha>` (deployed commit unknown)** or **(not found at the deployed commit)**: NCH couldn't read the deployed version, so it shows the latest one.

If the policy isn't in Git, the tab shows the YAML the clusters report, labeled "As reported by the clusters".

### Results

The **Results** tab has one row per cluster: the commit the policy runs at, the sync status, and the pass, fail, warn, and skip counts. Each cluster links to its policy report. You can sort the columns, search by cluster name, and filter by sync status.

## Changes made directly in GitLab

NCH reads the history from the Policy Set's branch in GitLab, so you don't have to make changes through NCH for them to be tracked:

- **Commits pushed directly to the branch** and **merge requests merged in GitLab** appear in the **Last Changed** column and on the **History** tab, the same way as changes made from NCH. The author, message, and SHA come from the Git commit.
- **Deploy state** works the same for every commit: when the operator syncs a commit made in GitLab, the policy shows **Deployed in `<sha>`** and the **Deployed** tag moves to that version.
- **Merge requests that are still open** in GitLab aren't on the History tab, because their commits aren't on the Policy Set's branch yet. They appear on the **Changes** tab with an **Opened outside NCH** tag. See [Merge requests opened outside NCH]({{< relref "/docs/control-hub/policy-hub/policy-sets/edit-policies/_index.md#merge-requests-opened-outside-nch" >}}).
- The History tab links each commit to GitLab, not to the merge request it came from. To find the merge request, use the **Changes** tab or GitLab.
- Only files under the Policy Set's directory are listed for a commit.
- A policy deleted from Git that still runs on a cluster has no Git data until the operator removes it.

## Limits

- **GitLab only.** For github.com, Helm, Kustomize, and HelmChart sets, the Deployed Policies tab shows the **Synced Commit** column instead of **Last Changed**. Synced Commit is the commit the whole Policy Set was last synced from on each cluster, not the commit that changed a given policy.
- **History length.** The drawer shows at most 100 commits. Older history is available only in GitLab.
- **File size.** Files larger than 1 MiB can't be shown ("File is larger than 1 MiB").
- **Delay.** NCH caches the branch head for 60 seconds, so a new commit can take up to a minute to appear.
- **Repository size.** NCH lists at most 500 policy files per repository. If the repository has more, a note above the table says some policies aren't shown.
- **Deployed state is based on commit dates.** **Not yet deployed** and the **Deployed** tag compare commit dates. A rebased or cherry-picked commit can carry an older date, so a change can show as deployed before the clusters have it.
- **Deleted policies.** A policy that was deleted from Git but still runs on a cluster has no Git data.


