This guide explains how to install a Discourse theme from a private Git repository.
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
-
Navigate to your Discourse admin panel.
-
Go to
Customize
>Themes
. -
Click on
Install
next to either “Theme” or “Theme Component”, depending on what you’re installing. -
Select
From a git repository
. -
Click on
Advanced
. -
Check the box that says
Theme is in a private git repository
.
-
Enter your repository URL using the SSH format:
git@github.com:USERNAME/REPO-NAME.git
.Make sure to use the clone with SSH link, not the one that starts with
https
. -
An SSH key will be generated and displayed at the bottom of the modal window.
-
Copy this SSH key.
-
In your Git repository settings (e.g., on GitHub, go to
Settings
>Deploy keys
), add a new deploy key. -
Paste the SSH key you copied from Discourse into the deploy key field.
-
Save the deploy key in your Git repository settings.
-
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 document
Perform check on document: