> ## Documentation Index
> Fetch the complete documentation index at: https://docs.creem.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub Repository Access

> Sell access to a private GitHub repository. Creem invites the buyer after they pay and removes them after a refund, a chargeback or the end of their subscription.

Sell access to a private GitHub repository as part of a product. After paying, the buyer connects their GitHub account and Creem invites it to the repository. When the order is refunded or charged back, or the subscription ends, Creem removes it again.

* **One-time product:** the buyer keeps access until the order is fully refunded or charged back.
* **Subscription:** the buyer keeps access until the subscription ends, its first payment is fully refunded, or one of its payments is charged back.

## Common Use Cases

* **Boilerplates and starter kits:** sell a codebase and ship updates through the same repository
* **Paid libraries and components:** give customers the source instead of a zip file
* **Sponsorware and early access:** let subscribers into a repository before it goes public
* **Courses and templates:** keep the example code next to the lessons it belongs to

## Before You Start

> [!NOTE]
>
> The repository must be **private** and owned by a **GitHub organization**. Public repositories and
> repositories of a personal account are listed in the product form, but can't be selected.

* You need to be the **owner of the Creem store** and an **owner of the GitHub organization**.
* A GitHub organization can be connected to one Creem store at a time.
* Each buyer is added to the repository as an **outside collaborator**. On a paid GitHub plan, each one can take a paid seat in your organization. If you don't want to pay GitHub for a seat per buyer, sell from an organization on GitHub's free plan.

## Setting It Up

**1. Connect your GitHub organization**

In the Creem dashboard, go to **Settings → Integrations** and click **Connect GitHub organization**.

GitHub asks you to install the Creem app on your organization. Choose **Only select repositories** and pick the repositories you want to sell. Creem only sees the repositories you pick here.

GitHub then sends you back to Creem, and the organization is listed as **Active**.

![The GitHub card in Settings, Integrations: a Connect GitHub organization button and the organization acme listed as Active, with a Disconnect button](https://mintcdn.com/creem/viw20t-hdfZhrbKQ/images/github-repository-access/settings-integrations.png?fit=max\&auto=format\&n=viw20t-hdfZhrbKQ\&q=85\&s=78fd4bb513fb3fbcecd5ac29631dddfd)

Settings → Integrations with one connected organization

The connection link is valid for 10 minutes. If it expires, click **Connect GitHub organization** again.

If you aren't an owner of the organization, GitHub sends your install request to its owners. Once one of them has installed the app, connect again while signed in to GitHub as an owner.

**2. Add the repository to a product**

Go to **Products**, then create a product or open an existing one. Under **Delivery**, add **GitHub repository access** and choose:

* **GitHub account:** the organization you connected
* **Repository:** the private repository the buyer gets
* **Buyer role:** what the buyer can do in the repository (see [Buyer roles](#buyer-roles))

![The Delivery section of the product form with a GitHub repository access item: GitHub account acme, repository acme/starter-kit, buyer role Read](https://mintcdn.com/creem/viw20t-hdfZhrbKQ/images/github-repository-access/product-github-repository-access.png?fit=max\&auto=format\&n=viw20t-hdfZhrbKQ\&q=85\&s=9669d7ff12eb14b700789794883afbad)

The GitHub repository access item in the product form

To sell several repositories with one product, add **GitHub repository access** once per repository.

**3. Save the product**

Every purchase made after you save includes access to the repository.

### Buyer roles

| Role | What the buyer can do |
| - | - |
| **Read** | View and clone the repository. The right choice for most products. |
| **Triage** | Read, and manage issues and pull requests: close, label and assign them. |
| **Write** | Read, and push code to the repository, including to branches without protection. |
| **Maintain** | Write, and manage some of the repository's settings. |

The admin role isn't offered. To change the role, pick another **Buyer role** in the product form and save. The new role applies to purchases made after the change; buyers who already bought keep theirs.

## What the Buyer Sees

Buyers don't type a GitHub username. They sign in to GitHub, so access always goes to an account they control.

**1. Connect GitHub after paying**

The confirmation page shows a **Connect GitHub to get repository access** button. The receipt email has a **Connect GitHub** button too, which opens the customer portal.

![Checkout confirmation page: Thank you for your payment, the receipt, and a Connect GitHub to get repository access button above View Order](https://mintcdn.com/creem/viw20t-hdfZhrbKQ/images/github-repository-access/checkout-confirmation.png?fit=max\&auto=format\&n=viw20t-hdfZhrbKQ\&q=85\&s=f5313b0e6df17dd88e5ca45e00c8f6f2)

The confirmation page of an order that includes a repository

**2. Sign in to GitHub**

Creem only reads which GitHub account it is. It gets no access to the buyer's repositories.

**3. Accept the invitation**

GitHub sends an invitation to the repository. The buyer accepts it on GitHub, or through **View invitation** on the order in the [customer portal](https://docs.creem.io/features/customer-portal.md).

![Customer portal order card with a GitHub access section: acme/starter-kit, Invitation sent: accept it on GitHub, a View invitation link, and Connected as @octocat](https://mintcdn.com/creem/viw20t-hdfZhrbKQ/images/github-repository-access/customer-portal-invited.png?fit=max\&auto=format\&n=viw20t-hdfZhrbKQ\&q=85\&s=dbff9245afe9b891c8ae68f86f444846)

The order in the customer portal while the invitation is open

**4. Use the repository**

Once the buyer accepts, the order shows **You have access.** and an **Open repository** link.

The button on the confirmation page works for one hour after the payment, in the browser that paid. After that, and for embedded checkouts or checkouts on a [custom domain](https://docs.creem.io/features/custom-domains.md), the buyer connects GitHub from the customer portal: they sign in with the email they used for the order and open the order's **GitHub access** section.

Each order is connected to **one GitHub account**, and the buyer can't switch it themselves. If they connected the wrong account, the store owner can [reset it](#managing-access-in-the-dashboard).

If the buyer's GitHub account already has access to the repository at the role you sell or a higher one, for example because they are a member of your organization, GitHub sends no invitation and the order shows **You have access.** right away. To test the invitation yourself, buy with a GitHub account that isn't in your organization.

### Invitations that expire

GitHub invitations expire after 7 days. When an invitation expires or is declined, the buyer can click **Send the invitation again** in the customer portal, at most once every 24 hours. The store owner can re-invite from the dashboard without waiting.

## Managing Access in the Dashboard

Open a payment in **Payments**, or a customer in **Customers**. The details panel has a **GitHub access** section with one entry per repository: the buyer role they bought, the buyer's GitHub account and user ID, when they were invited and accepted, and when and why access was removed.

![GitHub access section in the dashboard: acme/starter-kit, status Active, buyer role Read, GitHub account octocat, GitHub user ID, invited and accepted dates, and Revoke access and Reset GitHub account buttons](https://mintcdn.com/creem/viw20t-hdfZhrbKQ/images/github-repository-access/dashboard-github-access-panel.png?fit=max\&auto=format\&n=viw20t-hdfZhrbKQ\&q=85\&s=84d1ba4f01c9507dd9e9eb654090368c)

The GitHub access section of a payment

| Status | Meaning |
| - | - |
| **Awaiting GitHub account** | The buyer paid but hasn't connected a GitHub account yet. |
| **Invite pending** | The invitation is queued and will be sent shortly. |
| **Invited** | GitHub sent the invitation. The buyer hasn't accepted it yet. |
| **Active** | The buyer accepted and has access. |
| **Invite expired** | The invitation expired or was declined. |
| **Failed** | The invitation couldn't be sent. The panel shows the reason. |
| **Resetting account** | The store owner reset the GitHub account. Creem is removing the old account. |
| **Removing access** | Access is ending and Creem is removing the buyer on GitHub. |
| **Access removed** | The buyer no longer has access through this order. |
| **Removal failed** | Creem couldn't remove the buyer on GitHub. Remove them in the repository's settings. |

An accepted invitation shows as **Active** within about 15 minutes.

The store owner can also act on an order from this section:

* **Re-invite** on an entry that is **Invite expired** or **Failed**. GitHub sends the new invitation within a few minutes.
* **Revoke access** removes the buyer from every repository of the order. It doesn't refund the order, and access isn't restored automatically, not even if the subscription is reactivated.
* **Reset GitHub account** removes the connected account from every repository of the order. The buyer then connects a new account from their order in the customer portal. Creem doesn't email the buyer about the reset, so let them know.

## When Access Ends

Creem removes the buyer from the repository, or cancels their pending invitation, in these cases:

| Event | What happens |
| - | - |
| Full refund of the purchase | Access is removed. |
| Partial refund | Access stays. Several partial refunds that add up to the full amount remove it. |
| Refund of a single subscription renewal | Access stays while the subscription is active. |
| Chargeback opened | Access is removed. Winning the dispute doesn't restore it. |
| Subscription canceled at the end of the billing period | Access stays until the paid period ends, then it is removed. |
| Subscription canceled immediately, expired or unpaid | Access is removed. |
| Subscription past due or paused | Access stays. |
| The store owner clicks **Revoke access** | Access is removed. The order isn't refunded. |

Removal usually takes a few minutes.

> [!WARNING]
>
> Removing a buyer from the repository doesn't remove the copies they already cloned. Treat a
> one-time sale of repository access like a file download when you decide your refund policy.

* **Access isn't restored automatically.** To give it back, for example after you win a dispute or a subscriber pays again, add the buyer to the repository on GitHub yourself.
* **Removal applies to the GitHub account, not to the order.** If the same GitHub account bought access to the same repository twice, ending one order's access removes the account from the repository, while the other order's entry still shows **Active**.
* **Existing collaborators are removed too.** If the buyer was already a collaborator on the repository before they bought it, they lose that access when the order's access ends. Members of your organization keep the access they have through the organization or a team.

## Limits

* **50 invitations per repository per 24 hours.** This is GitHub's limit. Creem retries invitations above it later. If an entry ends up **Failed**, click **Re-invite** once 24 hours have passed.
* **One GitHub account per order.**
* **Organization-owned private repositories only.** On a personal account's repository, GitHub gives every collaborator write access, so those repositories can't be sold.

## Disconnecting GitHub

In **Settings → Integrations**, the store owner can click **Disconnect** next to an organization.

* **Disconnecting in Creem** removes the organization from Creem, so its repositories can't be picked for a product anymore. It doesn't stop sales: products that already sell its repositories keep giving new buyers access, even though the product form shows them as stopped working. To stop selling a repository, remove **GitHub repository access** from those products. The Creem app stays installed on GitHub, so buyers who already have access keep it, and Creem can still remove them after a refund, a chargeback or the end of a subscription. You can connect the organization again later.
* **Uninstalling the Creem app on GitHub** means Creem can no longer invite or remove anyone. Buyers who have access keep it until you remove them in the repository's settings, and new buyers don't get access. Remove **GitHub repository access** from your products before you uninstall.
* **Removing a repository from the Creem app on GitHub** breaks the products that sell it: new buyers get no access to it, and the product form shows that the repository stopped working. To fix it, add the repository back to the Creem app on GitHub, or choose another repository.

## Troubleshooting

> [accordion] A repository isn't listed in the product form
>
> Creem only sees the repositories you selected when you installed the Creem app. Open the app's
> settings in your GitHub organization, add the repository, then reload the product form.
> Repositories that are public or belong to a personal account are listed but can't be selected.

> [accordion] The organization wasn't connected
>
> Connect again while signed in to GitHub as an owner of the organization. If your organization
> uses single sign-on, sign in to it on GitHub first. If the organization was connected to another
> Creem store, disconnect it there, uninstall the Creem app in the organization's settings on
> GitHub, then connect again from this store.

> [accordion] The buyer didn't get an invitation
>
> Check the **GitHub access** section of the payment. **Awaiting GitHub account** means the buyer
> hasn't connected GitHub yet: send them to the customer portal. **Invite pending** for more than
> a few minutes means GitHub's daily invitation limit was reached or GitHub returned an error, and
> Creem is retrying. **Invited** means GitHub sent it: the buyer finds it in their GitHub
> notifications, in the email from GitHub, or through **View invitation** in the customer portal.

> [accordion] The buyer connected the wrong GitHub account
>
> Click **Reset GitHub account** in the **GitHub access** section of the payment, then tell the
> buyer to connect the right account from their order in the customer portal.

> [accordion] An entry says Failed
>
> The panel shows why. If the Creem app can no longer reach the repository, check that the app is
> still installed and that the repository is still selected, then click **Re-invite**.

> [accordion] An entry says Removal failed
>
> Creem couldn't remove the buyer, usually because the Creem app was uninstalled or can no longer
> reach the repository. Remove the buyer in the repository's settings on GitHub.

> [card] [Customer Portal](https://docs.creem.io/features/customer-portal.md)
>
> Where buyers connect GitHub and follow their invitation

> [card] [File Downloads](https://docs.creem.io/features/addons/file-downloads.md)
>
> Deliver files instead of a repository


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.