# GitHub Integration

## ✅ **Prerequisites**

{% stepper %}
{% step %}
**GitHub Account Consistency**

{% hint style="warning" %}
The GitHub account used for **Discloud login** AND **Repository ownership, must be the same.**
{% endhint %}

> **Consequences of mismatch**:
>
> * Repositories won't appear
> * Deployment failures
> * Permission errors
>   {% endstep %}

{% step %}
**Valid** [**`discloud.config`**](https://docs.discloud.com/en/configurations/discloud.config) **File**

Must exist in your repository's **root directory.**

> ⚠️ **Validation fails if**:
>
> * File missing
> * Invalid syntax
>   {% endstep %}
>   {% endstepper %}

***

## 🔄 **Connect GitHub & Configure Access**

{% stepper %}
{% step %}
**Initiate GitHub Connection**

* Go to [Discloud Dashboard](https://discloud.com/dashboard) → **GitHub Integration** tab
* Click **Login** → Authorize Discloud via GitHub OAuth

  <figure><img src="https://4206165266-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FETNoAt35DpCBhinHpaRx%2Fuploads%2Fqxnt7nsK9mM37pC5Ua5g%2Fchrome_mTljdz6Tcb.png?alt=media&#x26;token=851c5d3b-5f69-4476-ae07-037926c0d915" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}
**Configure Repository Access**

* Return to **GitHub Integration** → Click **Configure**
* Choose installation target.
* Set permissions:
  * 🔓 *All repositories*
  * 🔒 *Select specific repositories*
    {% endstep %}
    {% endstepper %}

***

## 🚀 **Deploy from GitHub**

{% stepper %}
{% step %}
**Start Deployment**

* Go to [Discloud Dashboard](https://discloud.com/dashboard)
* Click "**+ Upload"** (top-right corner)
* Select "**GitHub"** from the menu
  {% endstep %}

{% step %}

#### **Configuration & Upload**

{% hint style="info" %}

#### 🔐 Secure Environment Variables

Use [`.env`](https://docs.discloud.com/en/faq/general-questions/.env-file) files locally for development, but ensure they're added to `.gitignore` to prevent accidental exposure on GitHub. When deploying via Discloud's GitHub integration, **add production secrets directly in the "Environment Variables" section** during configuration.
{% endhint %}
{% endstep %}
{% endstepper %}

<figure><img src="https://4206165266-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FETNoAt35DpCBhinHpaRx%2Fuploads%2Fo9Kp7vZ343nISNJPPubv%2Fchrome_7Dz8CWZmOD.gif?alt=media&#x26;token=496e0d79-91fb-4a89-9e9c-75c8c38029cb" alt=""><figcaption></figcaption></figure>
