How to source a theme from a private git repository

In some setups you may prefer that your site’s themes are in a private git repository.

To do so:

Use the clone with SSH link, not the one that starts with https


Select theme is in a private git repository:

Paste in the public key into your git repo so it is the used as a “deploy key”

Click “Import” and you are done :confetti_ball:

Discourse will remember the private key it generated and use it to access the git repo.


Hi @sam,
This is an awesome feature.
Can it work with any repository on Git?

I tried with, but Discourse returns a

Error cloning git repository, access is denied or repository is not found

I guess it comes from somewhere in my setup, but I just wanted to be sure that gitlab was ok.

Yes, it should work with any Git repo. But you must use the SSH clone URL like Also try by pulling the latest version of Discourse.

I just updated my Discourse (yet was just one commit behind).
I still get the error message.

Vinoth, let me know if I should open a new discussion, I’m probably polluting here… not sure. Tell me and I’ll delete my messages from here to repost them in a correct section.

Can you try it GitHub. If it worked then it must be GitLab specific issue.

I have no private Github repo.
However, I face the same issue with Bitbucket private repo.

I just ran into the same issue @tanzaho mentioned but with a private GitHub repo. I haven’t nailed down exactly what’s going on yet. I was able to install successfully on a local instance but it fails on production. @vinothkannans, there aren’t any relevant logs that I can find.

1 Like

Now I am able to reproduce the issue in try using GitHub private repo itself. Let us check the issue.


@tanzaho @joebuhlig It is fixed as per commit


14 posts were split to a new topic: My broken Discourse install prevents theme upload

I found the ability to add a theme from github today. I was confused at first, because this is the view that is shown:


and there’s no visual clue how the theme’s code will be imported until after I enter in a URL. This led me to search for the answer (because why go create a repo for this, until I see how the site will be authorized). I finally found this topic, which makes the answer perfectly clear (via deploy key…not Oauth, etc)

It would be nice if there was some visual clue that an ssh keypair would be auto-generated.

Why? because the fact you did this amount of work reminds me of Penn’s quote:

The only secret of magic is that I’m willing to work harder on it than you think it’s worth.

I had no clue that the answer to authorization would magically appear in front of me!

Y’all did some amazing work here… bravo! :clap: