> For the complete documentation index, see [llms.txt](https://help.nightfall.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.nightfall.ai/data-exfiltration-prevention/exfiltration_endpoint/policies/trigger/git-push-monitoring.md). Agents can also search and read this documentation through its [MCP server](https://help.nightfall.ai/~gitbook/mcp).

# Git Push

Monitor or block Git push to repositories outside your approved Git destinations on macOS and Windows endpoints.

A Git Push policy watches `git push` on managed endpoints and checks where the code is going. If the destination is not one of your approved Git destinations, Nightfall records an exfiltration event. With **Block transfer** turned on, Nightfall also stops the push before any code leaves the device.

## What you will learn in this topic

By the end of this topic, you will know:

* The purpose of a Git Push policy and the signals Nightfall records for each push.
* The steps to create a Git Push policy that monitors or blocks pushes to unapproved repositories.
* The way to recognize what end users see when Nightfall blocks a push.
* How to plan around the limitations of Git Push blocking.

***

## Understand Git Push policies

Git Push policies in Nightfall run on the macOS and Windows agents. These Git Push policies evaluate where code is being pushed, not what is being pushed. Nightfall compares the push destination (the Git remote URL) with the approved Git destinations in your policy.

{% hint style="info" %}
**Note**:

*Content Scanning* is not supported for Git push currently.
{% endhint %}

Nightfall records the following signals during a Git push:

* The endpoint where the push starts (device ID and machine name)
* The repository name and its configured remotes
* The destination URL, which shows whether the push used HTTPS or SSH
* The parent process that ran the push, such as a terminal shell

The action you choose decides what happens when a push goes to an unapproved destination:

| Action                           | What Happens to the Push                                                                      | What Nightfall Records |
| -------------------------------- | --------------------------------------------------------------------------------------------- | ---------------------- |
| Monitor (**Block transfer** off) | The push completes.                                                                           | An exfiltration event  |
| Block (**Block transfer** on)    | Nightfall stops the push before any code leaves the device, and the `git push` command fails. | An exfiltration event  |

{% hint style="info" %}
**Note**:

Blocking is based on the push destination only. Nightfall does not scan the pushed code before it blocks a push.
{% endhint %}

#### Supported Git destinations

Git Push policies support the following destinations:

* GitHub Cloud
* GitLab Cloud
* Bitbucket
* Any Git server accessible over HTTPS or SSH

***

## Working of Git push policies

The following flowchart illustrates the working of Git push policies:

<figure><img src="https://3764378997-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZeqNSdo8J8cLJPU3Gs5M%2Fuploads%2FE4Fng20uWr3J8CIgZ3EO%2Fnightfall_exfil_policy_git_push.png?alt=media&amp;token=b8a112bb-ea2b-4956-a01e-8d3080ce1305" alt=""><figcaption></figcaption></figure>

***

## Before you begin

Complete the following checks before you create a Git Push policy:

* Make sure that the **Endpoint** integration shows as **Connected** in the Nightfall console. To verify this, log in to your Nightfall account and navigate to **Configuration** -> **Integrations**.
* Make sure that the endpoints in scope run an agent version that supports Git Push blocking, if you plan to block pushes. Agents that do not support blocking keep monitoring, which means that the push completes, and Nightfall records a monitored event.
* Ensure that Git Push blocking is available for your tenant. If **Block transfer** does not stop pushes, contact your Nightfall account team.
* Ensure that you have a domain collection that lists your approved Git destinations. For examples of entries, see the section below.

### Approved Git destinations

Add one entry per approved organization, group, or server to a domain collection, for example:

* `github.com/my-company-org/*`
* `gitlab.company.com/*`
* `bitbucket.org/company/*`

***

## Create a Git Push policy

To create a Git Push policy, complete the following steps:

### Step 1: Start a new endpoint policy

This step enables you to choose Endpoint for policy configuration:

1. Log in to your Nightfall account.
2. Navigate to **Configuration** → **Policies**, and click **New Policy**.
3. In the **What type of policy would you like to create?** window, select **Exfiltration**.
4. In the **What would you like to monitor?** window, select **Endpoint**.

### Step 2: Define the scope

This step enables you to select the devices that the policy should apply to:

1. **Select Operating System**: Select **macOS**, **Windows**, or both. By default, both are selected.
2. **Select Device**: Select **All Devices**, **Specific Devices**, or **All Devices, except** specific ones. By default, **All Devices** is selected.
3. (Optional) **Add Filter**: Include or exclude specific users.
4. Click **Next**.

<figure><img src="https://3764378997-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZeqNSdo8J8cLJPU3Gs5M%2Fuploads%2F4Wv69yYbjnEUxaqlT2Fm%2Fnightfall_exfil_policy_scope.png?alt=media&amp;token=d3a6b9ac-351d-4c04-b349-8a4eea7e57a5" alt="" width="563"><figcaption><p>Policy Scope</p></figcaption></figure>

### Step 3: Configure the trigger

This step enables you to decide when the policy is triggered:

1. **Action** (**For**): Select **Git Push to**.
2. **From** (**Data Source**): Select **Any** to evaluate pushes from all repositories, or select **Source (Domain / URL-Based)** to evaluate only repositories that came from specific sources.
3. **Corporate accounts only** (for **Source (Domain / URL-Based)** data sources only): Enable this toggle to evaluate specific accounts within or not within the collection you selected above. While Nightfall supports session detection for certain domains, for the ones that Nightfall does not support, you can select the action that Nightfall should take.
4. **Data Destination**: Select one of the following options:
   * **Any domain**: Evaluate pushes to every destination.
   * **Domain in**: Evaluate pushes to the destinations in a domain collection.
   * **Domain not in** (**Recommended** with your approved Git destinations): Evaluate pushes to every destination outside a domain collection.
5. **Personal accounts only** (for **Source (Domain / URL-Based)** data sources only): Enable this toggle to evaluate specific accounts within or not within the collection you selected above. While Nightfall supports session detection for certain domains, for the ones that Nightfall does not support, you can select the action that Nightfall should take.
6. Click **Next**.

<figure><img src="https://3764378997-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZeqNSdo8J8cLJPU3Gs5M%2Fuploads%2FSHQi3CDlzw5tAi0Za5KC%2Fnightfall_exfil_policy_trigger.png?alt=media&amp;token=ec2650ce-d07f-4782-a862-9b683e142992" alt="" width="563"><figcaption><p>Trigger for Policy</p></figcaption></figure>

### Step 4: Configure advanced settings

This step enables you to decide what happens when a push matches the policy:

1. **Admin Alerting**: Turn on the alert platforms that should receive the event: **Slack Alert**, **Jira Alert**, **Email Alert**, or **Webhook Alert**.<br>

   <figure><img src="https://3764378997-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZeqNSdo8J8cLJPU3Gs5M%2Fuploads%2F52lIczvni28f5gjjuBmC%2Fnightfall_exfil_policy_alerting.png?alt=media&amp;token=f943f93d-80d6-4bcc-b7b7-2d40f7b46fb1" alt="" width="563"><figcaption><p>Alerting for Policy</p></figcaption></figure>
2. **Automated Actions**: Choose whether you wish to monitor or block the push:

   * To monitor only, leave **Block transfer** off. The push completes, and Nightfall records an exfiltration event.
   * To block, turn on **Block transfer**. Nightfall stops the push and records an exfiltration event. Then configure the dialog that the end user sees:
     * **Customize on-device dialog's title**: Specify a title for the dialog.
     * **Customize on-device dialog's message**: Specify the message the end user sees. The default message is: *This action is not allowed per your organization's security policies. This may be due to the sensitive nature of the content, source, or destination.* Click **Reset to default** to restore it.
     * **Allow end-user to request exception with justification**: When turned on, end users can submit a justification to request temporary approval, and the admin decides the exception duration when approving the request. The default is **Off**.
   * **Record Before & After** (optional): Record a video before and after the event. For more information, see [Session Replay and Bring Your Own Bucket](https://help.nightfall.ai/data-exfiltration-prevention/exfiltration_endpoint/policies/advanced_settings/automated_action/session-replay-and-bring-your-own-bucket.md).

   <figure><img src="https://3764378997-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZeqNSdo8J8cLJPU3Gs5M%2Fuploads%2FG0CYZwVTUqVkodi9FxH1%2Fnightfall_exfil_policy_automated_actions.png?alt=media&amp;token=e5847b29-1493-4847-a004-2925688bb443" alt="" width="563"><figcaption><p>Automated Actions for Policy</p></figcaption></figure>
3. **End User Notification**: Optionally enter a **Custom Message** and choose whether to send it automatically **Via Slack**, **Via Email**, or **Via Endpoint**. You can also let end users remediate the violation, for example by providing a business justification.
4. Click **Next.**

<figure><img src="https://3764378997-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZeqNSdo8J8cLJPU3Gs5M%2Fuploads%2FIhJhEnvO2Di9cGOyb5mf%2Fnightfall_exfil_policy_end_user_notification.png?alt=media&amp;token=0e076cce-f6ab-41c8-9e7e-0c80d7a7df16" alt="" width="563"><figcaption><p>End User Notification for Policy</p></figcaption></figure>

### Step 5: Name and review the policy

This step enables you to add details about the policy and save it:

1. Specify a **Policy Name**.
2. (Optional) Specify a **Policy Description**.
3. Under **What is this policy's risk level?**, select **Nightfall Risk Score** or **Custom Risk Score**.<br>

   <figure><img src="https://3764378997-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZeqNSdo8J8cLJPU3Gs5M%2Fuploads%2FnMlkQGCd7td2JGA1eYmC%2Fnigthfall_exfil_policy_name_description.png?alt=media&amp;token=33e8580f-587b-4151-9924-a5c059fcbe20" alt="" width="563"><figcaption><p>Policy Details</p></figcaption></figure>
4. Click **Next**, review the settings on the **Edit & Review** page, and click **Submit**.

After you submit the policy, it appears in the policy list with **Git push** in the **Action** column.

For a full source code policy set, see [Recommendation 2: Source code](https://help.nightfall.ai/data-exfiltration-prevention/exfiltration_endpoint/policies/recommended-policy-configurations.md).

***

## What end users see when a push is blocked

When Nightfall blocks a push, the `git push` command fails and the end user sees a dialog that explains why. The dialog shows the title and message configured under **Block transfer**.

If **Allow end-user to request exception with justification** is on, the end user can request temporary approval from the dialog.

For Monitor policies, the push completes. The end user receives a notification only if you configure **End User Notification** for the policy.

***

## Event details

When a Git push violates a policy, Nightfall generates an event with metadata only. Nightfall does not collect the pushed code.

To view Git push events, navigate to **Incidents** → **Exfiltration Prevention**. Each event appears in the list as **Git push**, with the repository name below it, and displays the **Location**, **When**, **Risk**, and **User** columns. For Git push events, the **User** column shows the machine name and device ID. Click an event to open its details panel, which has a **Summary** tab and a **Device** tab.

<figure><img src="https://3764378997-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZeqNSdo8J8cLJPU3Gs5M%2Fuploads%2F1zqq6xEvgzjHwrEEnMpc%2Fnightfall_exfil_prevention_summary.png?alt=media&amp;token=d83509f3-aa0a-4cbf-9eee-f22399db612a" alt="" width="563"><figcaption><p>Git Push Summary</p></figcaption></figure>

The **Event summary** section on the **Summary** tab displays the following fields:

| Field                   | Description                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------------- |
| **Assets**              | The repository that was pushed                                                               |
| **Policy**              | The policy that the push violated                                                            |
| **Device ID**           | The ID of the endpoint where the push started                                                |
| **Machine name**        | The name of the endpoint                                                                     |
| **Git Repository Name** | The name of the repository                                                                   |
| **Parent Process Name** | The process that ran `git push`, for example `/bin/zsh`                                      |
| **Destination URL**     | The Git remote URL the code was pushed to, for example `ssh://github.com/<org>/<repo>.git`   |
| **Git Remotes**         | The repository's configured remotes, for example `origin: ssh://github.com/<org>/<repo>.git` |

The event also displays a risk level (Critical, High, Medium, Low, or Unknown) and a status, such as **Active**. You can leave a comment on the event from the details panel.

***

## Example scenarios

The following scenarios display how a Git Push policy behaves when set for monitoring and/or blocking:

| Scenario                                   | Monitor Policy                                    | Block Policy                                                     |
| ------------------------------------------ | ------------------------------------------------- | ---------------------------------------------------------------- |
| Push to an approved repository             | The push completes. No event.                     | The push completes. No event.                                    |
| Push to an unapproved repository           | The push completes. Nightfall generates an event. | Nightfall stops the push and generates an event.                 |
| Push over HTTPS or SSH                     | Detection works for both protocols.               | Blocking works for both protocols.                               |
| Push to a repository with multiple remotes | The event reflects the remote used for the push.  | Nightfall blocks the push if any destination matches the policy. |
| `git push --dry-run`                       | Nightfall records a Monitor event.                | The command is allowed, and Nightfall records a Monitor event.   |
| Push to a repository on the same device    | Nightfall ignores the push.                       | Nightfall ignores the push.                                      |
| Push from an unmanaged device              | No detection without an endpoint agent.           | No detection without an endpoint agent.                          |

***

## Common use cases

Git Push policies cover these common cases:

* **Personal GitHub usage**: Approve `github.com/company-org/*`. Nightfall detects or blocks a push to `github.com/john-doe/test-repo`.
* **Scratch or temporary repositories**: Nightfall evaluates the push by destination, so a new or unnamed repository outside your approved list is detected or blocked.
* **Corporate GitHub and GitLab usage**: Add your corporate GitHub organizations and internal GitLab instances to the approved list, so that pushes anywhere else are detected or blocked.

***

## Limitations of Git Push blocking

Review these limitations before you rely on blocking:

* Nightfall blocks pushes made with the Git command-line program, including pushes from IDEs and Git clients that run it. On Windows, this includes VS Code and GitHub Desktop. Git clients that do not run the Git program, such as clients built on `libgit2`, are not blocked.
* If the agent cannot evaluate a push, it allows the push.
* **For macOS only**: Nightfall blocks pushes made with Git installed in standard locations (system Git, Xcode Command Line Tools, Xcode, Homebrew, and MacPorts). Pushes made with Git installed elsewhere are monitored but not blocked.
* **For Windows only**: Nightfall reads the destination from the repository's own Git configuration. Git aliases, the `GIT_DIR` and `GIT_WORK_TREE` environment variables, URL rewrites in the user's global or system Git configuration, `includeIf` conditions, and bare repositories are not evaluated.


---

# 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://help.nightfall.ai/data-exfiltration-prevention/exfiltration_endpoint/policies/trigger/git-push-monitoring.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.
