> For the complete documentation index, see [llms.txt](https://docs.docontrol.io/docontrol-user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docontrol.io/docontrol-user-guide/integrations/github.md).

# GitHub

GitHub is an Internet hosting service for software development and version control. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous integration, and wikis for 94 million developers.

Although GitHub is the most popular software version control standard today, it's built for collaboration, not security.&#x20;

With many organizations relying on GitHub for code management, Git has become a popular attack vector for hackers. Without security governance, it's relatively easy to hardcode sensitive data, upload sensitive files to a public GitHub repository, or become vulnerable to a supply-chain attack.

## Use cases

Integrate GitHub with DoControl to detect and prevent unnecessary exposure on GitHub:

* **Get full inventory visibility** - Discover your data exposure for new applications, repos, and users within GitHub, including publicly visible assets
* **Trigger alerts** - Get real-time event notifications for anomalous activity and file overexposure, such as, extensive public burst sharing
* **Mitigate future data exposure** - Leverage automated workflows to reduce unnecessary exposure. For example, you can notify the security team when someone makes a GitHub repository public, or notify when GitHub apps are installed
* **Manage SPM misconfigurations** - See how your GitHub security settings measure up to compliance standards, avoid security vulnerabilities, and remediate if necessary

## Prerequisites

To integrate GitHub with DoControl, make sure you have fulfilled these prerequisites:

* Team plan or above.
* Before starting to integrate, you need to sign up with DoControl. Follow the onboarding steps in [Create first account](/docontrol-user-guide/getting-started/quick-start/set-up-docontrol-basics.md#create-first-account).

## Required permission scopes

For more information on permission scopes and events, see [GitHub support](https://docs.github.com/en/rest/overview/permissions-required-for-github-apps?apiVersion=2022-11-28#metadata-permissions).

### Read access to members

* [Metadata](https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#metadata-permissions)&#x20;
* [Organization events](https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#permission-on-organization-events)
* [Organization user blocking](https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#permission-on-organization-user-blocking)
* [Pull requests](https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#permission-on-pull-requests)

### **Read and write access to administration**

* [Organization administration](https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#permission-on-organization-administration)
* [Organization hooks](https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#permission-on-organization-hooks)
* [Repository hooks](https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#permission-on-repository-hooks)

### Events

* [Meta](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#meta): When GitHub is deleted and the associated hook is removed
* [Member](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#member): Activity related to repository collaborators
* [Organization](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#organization): Activity related to an organization and its members
* [Membership](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#membership): Activity related to team membership
* [Public](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#public): When a private repository is made public
* [Pull request](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request): Activity related to pull requests
* [Repositories](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository): Activity related to repositories
* [Team](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#team): Activity related to an organization's team
* [Team add](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#team_add): When a [repository is added to a team](https://docs.github.com/en/rest/reference/teams#add-or-update-team-repository-permissions)
* [Org block](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#org_block): Activity related to people being blocked in an organization

## Integrate GitHub with DoControl

{% hint style="warning" %}
**Existing customers**: To view [SPM misconfigurations](broken://pages/GCfjoq8jyb4hmyup5J4o), you must re-integrate DoControl with GitHub.&#x20;

The integration wizard automatically adds the required permission for DoControl to validate that you have the proper workflows in place according to CIS compliance:

`Actions:read`
{% endhint %}

1. From the DoControl side menu, click **Integrations**.\
   ![](https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FTNHqtZi4QV9dr8Jb6TgQ%2Fintegrate%20GitHub.png?alt=media\&token=7a2bfb59-e1e0-4807-b8d1-769b3b6af3d9)
2. Under **GitHub**, click **Connect**. <br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2Fu73NOl1kqpo8aCeQled4%2FGitHub%20wizard%20misconfig.png?alt=media&amp;token=972fd07f-756a-4194-9bb9-582e0126eeb7" alt=""><figcaption></figcaption></figure>
3. Click **Next**.
4. Select the GitHub account to integrate with DoControl.
5. Select which repositories to include: **All repositories** or **Only select repositories**. For integrating specific repositories, select them one by one.
6. Click **Install**. GitHub is now integrated with DoControl.

## Troubleshooting

Q. What happens if my GitHub token expires?

A. If the person who performed the integration leaves your organization, your GitHub token will expire. You need to reconnect to DoControl by performing the [integration procedure](#integrate-github-with-docontrol) again.


---

# 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.docontrol.io/docontrol-user-guide/integrations/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.
