Hosting customized jekyll fork on github pages

What I’ve done is:

  1. Fork an existing jekyll theme

  2. Modify it by serving the site locally to view changes

Now I want to host it on github, but it appears I did the steps in the wrong order. I think I was supposed to create the github site first and then configure it for jekyll. How do I salvage this situation and get my site onto github pages?

If you just fork repository, and still keep same name. I suggest you change the repository name to username.github.io
is your Github username.

Wait a few min, so Github pages build and deploy. And go to your username.github.io to see it live.

I remember a long time ago, in 2016-2017, I forked a repository of one developer that I really can’t remember the name of. After two weeks of editing and dev the code in my way, getting the sites live, and looking more significant than the original repository of that developer, he immediately deleted his own. Even now, I don’t understand, but at that moment, it affected me a lot; it felt so hurt that I looked like a theft. Lol

@ninja The jekyll theme I use is not configured to work with github pages because I don’t think it has that github-pages plugin. In that case, do I need to add anything to the pre-existing gemfile/config to get it to work? Or can I go ahead with the changes you suggested without doing any of this.

what doesn’t work with what you did? do you get an error?

Can you share a link to the repo?

I don’t use themes so can’t help much. But if it works locally but won’t work on GH pages due to an incompatible plugin or theme you can probably use GH actions to get it to work.

@rdyar

So far I haven’t tried what @ninja suggested so I don’t know whether it’s going to work or not, I am asking whether I need to setup anything related to github pages inside my fork before actually going ahead and renaming my fork to username.github.io as ninja suggested.

Here is the theme I forked: GitHub - ritijjain/pudhina-fresh: A minimal yet feature-rich Jekyll theme made for personal websites and blogs.. As you may notice, there are no plugins related to github pages installed, so I’m asking whether I need to do anything regarding that.

not that I know of - there should not be any conflict if you fork something - it will be under your name as a new project.

I don’t think you need to rename it.

What was your issue when you forked it? did you get an error when trying to view the site? I assume you did a git commit and git push to get your changes back up to your repo on GH? or is that the problem?

Perhaps you can clarify your question a little more? How did you clone the repo? If you cloned it on GitHub, then you have a brand new GitHub repo. Simply push your local changes up to that cloned repo and then go to the repo’s settings and enable Pages. Granted, you may encounter other issues (like having to configure the url and baseurl in the _config.yml file, but that should do the trick.

If, on the other hand, you forked the code from GitHub to your local computer (meaning your GitHub account does not have a copy of the fork), then you could push it up to GitHub, but you might have to do some more advanced steps. You may also want to disconnect from the original source code so it is no longer forked. There are ways to do this with Git, but here is the approach I use

  1. Go to GitHub and create a new repo where you will put your new GitHub Pages website. When doing so:
    a. Add a readme
    b. Select a Jekyll .gitignore template

  2. With the new repo, go to settingspages and enable GitHub Pages on main/root

  3. On your local computer, clone your newly created repo

  4. We are going to lift a bunch of code from the locally forked repo and move it into your new GitHub Pages repo, so now is the time to commit all changes you made

  5. Open the forked repo in a standard file viewing app such as File Explorer in Windows, Finder on the Mac, etc. and make sure you are not displaying hidden files so you do not bring over Git’s hidden storage and configuration files

  6. Copy all the files from the forked repo to your new GitHub Pages repo, but do not copy over the .gitignore file. You can always compare the two files and add any more ignores that the other forked repo may use

  7. Go into your locally cloned GitHub Pages repo that should now only contain the pure code from the forked repo and it is disconnected from the fork (because you did not copy over hidden files)

  8. In your GitHub Pages repo, install the Jekyll dependencies by running:

bundle init
bundle update
  1. Test the site by running the following command. If you come up on errors, address them one at a time (for example, you might need to run bundle add webrick depending on the version of Jekyll you are using)
bundle exec jekyll serve --livereload
  1. Update the _config.yml file to include the correct url and baseurl settings based on your GitHub Pages url on GitHub

  2. Commit the changes to your local GitHub Pages code and push the code up to GitHub

  3. Depending on the size of your site, GitHub Pages should build your site and you can take a look at it

I hope this helps