Installing a theme from a private Git repository

:bookmark: This guide explains how to install a Discourse theme from a private Git repository.

:person_raising_hand: Required user level: Administrator

Summary

This documentation covers the process of installing a Discourse theme from a private Git repository. It includes steps for generating and using SSH keys for secure access.

Prerequisites

Before you begin, ensure you have:

  • Administrator access to your Discourse instance
  • A private Git repository containing your theme
  • Access to add deploy keys to your Git repository

Step-by-step guide

  1. Navigate to your Discourse admin panel.

  2. Go to Customize > Themes.

  3. Click on Install next to either “Theme” or “Theme Component”, depending on what you’re installing.

  4. Select From a git repository.

  5. Click on Advanced.

  6. Check the box that says Theme is in a private git repository.

  7. Enter your repository URL using the SSH format: git@github.com:USERNAME/REPO-NAME.git.

    :warning: Make sure to use the clone with SSH link, not the one that starts with https.

    image

  8. An SSH key will be generated and displayed at the bottom of the modal window.

  9. Copy this SSH key.

  10. In your Git repository settings (e.g., on GitHub, go to Settings > Deploy keys), add a new deploy key.

  11. Paste the SSH key you copied from Discourse into the deploy key field.

  12. Save the deploy key in your Git repository settings.

  13. Return to the Discourse theme installation modal and click Install.

Best practices

  • Always use the SSH URL for your repository, not the HTTPS URL.
  • Keep your deploy keys secure and don’t share them publicly.
  • Regularly update your theme to ensure you have the latest features and security updates.

Common issues and solutions

  • If you don’t see the “Theme is in a private git repository” option, ensure your Discourse version supports this feature. Update to the latest version if necessary.
  • If you encounter permission errors, double-check that you’ve correctly added the deploy key to your Git repository.

FAQs

Q: Can I use this method with Git providers other than GitHub?
A: Yes, this method should work with any Git provider that supports deploy keys or SSH authentication.

Q: Will Discourse remember the SSH key for future updates?
A: Yes, Discourse will store the generated private key and use it for future access to the Git repository.

Q: Can I change the private repository later?
A: Yes, you can update the repository URL in the theme settings if needed.

Additional resources

Last edited by @hugh 2024-07-16T04:20:34Z

Check documentPerform check on document:
33 Likes

3 posts were split to a new topic: Why is the ‘private repository’ option not showing up?