This is an introduction to using version control with Git and GitHub. No prior experience with version control is assumed. The material is based on the Software Carpentry lesson and the work of Aleksandra Pawlik, but has been heavily modified.
Instead of installing ruby and jekyll, you can use docker to run a live version of your repo locally. As you make changes, it will recompile the changes and all you will need to do is refresh the browser.
The following command it assumes that you are inside your cloned github repo. Adapted from this blog:
docker run --rm -it --volume="$PWD:/srv/jekyll" --volume="$PWD/vendor/bundle:/usr/local/bundle" \
--env JEKYLL_ENV=development --platform linux/amd64 -p 4000:4000 jekyll/jekyll:4.0.1 \
jekyll serve --config _config.yml,_config_dev.yml
You should then be able to open the live page at http://localhost:4000/
What this command does is
--rmautomatically removes the container when it exits-itallows you to interrupt the running server to exit with Ctrl+C--volume="$PWD:/srv/jekyll"takes the current directory indicated by$PWDand map it to the directory at/srv/jekyllwithin the container so that it could build it--volume="$PWD/vendor/bundle:/usr/local/bundle"this option maps the contents of the current directory's/vendor/bundleand maps it to/usr/local/bundle. The reason for this option is so that gems could be cached and reused in future builds--env JEKYLL_ENV=developmentallows local development.--platform linux/amd64allows mapping the host platform to linux/amd64, an known issue for Apple silicon (see here)jekyll/jekyll:4.0.1this tells it to use this specific tagged version of the Jekyll containerjekyll serve --config _config.yml,_config_dev.ymlserves the live compiled content
If you already have jekyll installed for other projects, you can run
jekyll serve --config _config.yml,_config_dev.yml inside your cloned github repo.