How to source a theme from a private git repository


(Sam Saffron) #1

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

image

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.


502 error while importing private theme
Structure of themes and theme components
(Jean Christophe “Jice” Lavocat) #7

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


I tried with Gitlab.com, 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.


(Vinoth Kannan) #8

Yes, it should work with any Git repo. But you must use the SSH clone URL like git@gitlab.com:gitlab-org/gitlab-ce.git. Also try by pulling the latest version of Discourse.


(Jean Christophe “Jice” Lavocat) #9

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.


(Vinoth Kannan) #10

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


Configuring custom private repo of discourse through docker
(Jean Christophe “Jice” Lavocat) #11

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


(Joe Buhlig) #12

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.


(Vinoth Kannan) #13

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


(Vinoth Kannan) #14

@tanzaho @joebuhlig It is fixed as per commit


(Jeff Atwood) split this topic #15

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


(Allen - Watchman Monitoring) #16

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

2019-03-21_21-47-21

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: