Proper way to clone a Jekyll theme site on Github/Netlify setup

I’m working on a personal project and practicing along the way, and I used a free jekyll theme to make a little website, hosted on Github and deployed via Netlify.

There are a lot of changes I made to stylesheets and content of the theme, and I want to create a second site but I don’t want to use the empty theme as a starting point, but rather start from this current website I customized.

So my question is, what’s the proper way to duplicating my current jekyll site? Is it enough and technically correct to clone the repo, or is there something else I should take care of?

you probably want to fork it to create a new independent repo for the 2nd site. You could also just download the repo and then add it as a new repo but that is more work I think. When I do that I delete the .git folder and then do git init to make it a new repo. But Fork should be better and do what you want.

fork vs clone google:

Any public Git repository can be forked or cloned. A fork creates a completely independent copy of a Git repository. In contrast to a fork, a Git clone creates a linked copy that will continue to synchronize with the target repository.

1 Like

From what I can see in my Github, I’m not allowed to fork my own repo because I’m not a member of any organizations.

If I manage to duplicate/clone/copy paste the repo1 (main one) into a repo2 - will the website in the repo2 work properly, because it should work just like the one from repo1.

Another idea I had - but don’t know how to do it - put default theme files in both repos, edit the theme locally and apply those changes / commits to both repos. But that doesn’t seem simple, I can’t google out how to do it.

hmm, looks like you’re right, which may be why I’ve never done that.

I would go into GH and create a new empty repo, then clone it locally (the new one) so you have it on your computer. Then paste all the files into it, add them to git and then push it back up to GH.

your last idea is probably not a good one, I don’t know how to do that.

2 Likes

I think I’m looking for these types of solutions because I don’t know how these Jekyll sites “work” I don’t have the proper understanding.

Let’s say I have a folder where I edit my Jekyll theme, it’s the folder where I run all the bundle jekyll serve commands, for localhost testing etc…if I uploaded that folder, with all my edits, to another repo, and deploy that other repo with Netlify - it would work properly?

I might ask stupid questions but like I said, it comes from me being clueless about how these things work - the theme readme uses words like “install theme” and when I hear the phrase install, I’m thinking of software I install, and usually software doesn’t work by copy pasting it in a new place, so I have the same confusion with Jekyll stuff

you have a folder with stuff in it - is that folder a git repo? is there a .git folder in it? if there is and you then paste all that stuff into a new folder and go to make it into a git repo you may have issues as the .git folder has stuff in it that pertains to the first folder and you are not going to want that to be in a different repo. I’m not sure what would happen.

If you delete the .git folder then it will be ok. Without the .git folder it is not a git repo any more.

So if you have a folder that has a jekyll site that works and it has a .git folder you can copy everything but the .git folder and paste that into a new folder and you should have a duplicate site that will work as its own thing.

This is where getting that second site up to GH can be a little tricky - this is where I would make a new empty GH repo, then clone it locally which will give you an empty folder locally, then paste the stuff from the first site in there, then git add it and then push it and you should have 2 different repos with the same site and you can edit the 2nd one to make it different.

The word Theme is confusing in the jekyll world, there are 2 ways a ‘theme’ could work in jekyll.

  1. an actual jekyll theme that is gem based - this is something that does get installed as a gem and the contents of that theme are by default more or less hidden from you. I do not like these.
  2. the theme is really just some css and layouts and includes and what not that all exist as part of the repo. There is no install step, it is just css. This is what I use and I don’t call it a theme.

It sounds like you are doing the 2nd one as you have all the files there. But you can also do that with a gem based theme which just adds to the confusion.

1 Like

Thanks a bunch! Clears things up a bit for sure! As far for my “theme”, it does have gemfile.lock file in the root, so is that enough to classify it as gem based?

not necessarily, I think any site with bundler gets a gemfile.lock as that is what it is using to do all the same gem versions and what not.

a gem based theme I think is specified in the config file? like theme: jekyll-theme-minimal

this page has a lot of info on themes, bundler and gem stuff:

1 Like