Personal GitHub site
GitHub Codespaces allows for using an IDE like VSCode in the web browser in a Virtual Machine (VM), hosted by and integrated with GitHub.
To locally preview GitHub Pages, you’d need Jekyll and Ruby. However, using Codespaces, you can simply start up the VM with a preset of Jekyll and Ruby installs to preview your pages wherever and whenever.
The following steps allow you to preview GitHub Pages in Codespaces:
git clone https://github.com/devcontainers/images.git
/images/src/jekyll/.devcontainer/
folder and copy-paste it into the root of your own Repository (root of the file browser)/vscode-dev-containers/
since this its contents are no longer needed/.devcontainer/devcontainer.json
, set the value of "remoteUser"
to "root"
/.devcontainer/
changes to the origin to make sure Codespaces can build with the new containerGemfile
in the root folder, the development container will install all gems at startup by running bundle install
. This is the recommended approach as it allows you to specify the exact Jekyll version your project requires and list all additional Jekyll plugins.If there’s no Gemfile
, the development container will install Jekyll automatically, picking the latest version. You might need to manually install the other dependencies your project relies on, including all relevant Jekyll plugins.
Refer to this guide for more details.
Serve the Jekyll site locally: bundle exec jekyll serve
.
This command expects a Gemfile to be present. If it’s not present:
bundle init
gem "github-pages", "~> GITHUB-PAGES-VERSION", group: :jekyll_plugins
to the GemfileGITHUB-PAGES-VERSION
with the latest supported version of the github-pages
gem. You can find this version at Dependency versions.bundle install
bundle exec jekyll serve