View Categories

Adding a GitHub Collection

A GitHub collection lets you import a snippet library from a GitHub repository and keep it in sync automatically. Private repositories need a token; see Private repositories.

GitHub collections are part of the Premium and Agency plans. On Pro, you can still copy a public repository’s snippets onto your site once with Import from GitHub; those snippets are not updated from the repository afterwards.

Supported URL formats #

  • https://github.com/user/repo — imports from the repo root on the default branch.
  • https://github.com/user/repo/tree/branch — imports from a specific branch.
  • https://github.com/user/repo/tree/branch/subdir — imports from a subdirectory.
  • github.com/user/repo or user/repo — shorthand forms; GOCSM normalizes them to GitHub HTTPS URLs.

The repository must contain a snippets.json manifest file at the root of the import path. See Creating Your Own Snippet Library for the manifest format.

Adding the collection #

  1. Go to the Collections tab.
  2. Under Add Collection, select GitHub repository as the source.
  3. Paste the repository URL.
  4. Optionally enter a branch override. Leave it blank to use the branch from the URL, or to probe main and then master.
  5. Optionally enter a display name. If left blank, GOCSM uses the name from the manifest after the first successful sync.
  6. Click Add Collection.

GOCSM fetches the manifest, validates it, and imports all snippets. The initial import may take a few seconds depending on the number of snippets. If the manifest cannot be fetched or fails validation, the collection is not kept. If an individual snippet cannot be fetched, that snippet is skipped and logged in the Sync Log, and the rest of the collection is kept.

Browsing imported snippets #

After the import, all snippets from the collection appear in the Snippets tab. They are imported as inactive. You can activate them individually after configuring any required config values.

Auto-update #

You can turn on Auto-update in three places: the Auto Update checkbox on the Add Collection form (its default comes from Settings > Default auto-update for new collections), the toggle on the collection’s row, and the collection’s Edit form. When enabled, GOCSM automatically applies non-warning updates. Updates that remove existing config variables are always held for manual review.