This guide provides step-by-step instructions for deploying your Jekyll portfolio to GitHub Pages.
# Install Bundler if not already installed
gem install bundler
# Install Jekyll and dependencies
bundle install
# Start the Jekyll development server
bundle exec jekyll serve
# Or with live reload
bundle exec jekyll serve --livereload
# Or serve on all interfaces (for network access)
bundle exec jekyll serve --host 0.0.0.0
Open your browser to:
http://localhost:4000http://[your-ip]:4000 (if using –host 0.0.0.0)✨ This repository now includes automated GitHub Actions deployment!
The automated workflow provides several benefits:
- 🚀 Controlled deployment only when merging to
gh-pagesbranch- ⚡ Faster builds with Ruby 3.1 and bundler cache
- 🔒 Consistent environment with proper production settings
- 🛡️ Clean main branch with no automatic commits
- 📦 Proper artifact handling with official GitHub Pages actions
Choose your preferred deployment method below:
# If starting fresh
git init
git add .
git commit -m "Initial Jekyll portfolio commit"
git remote add origin https://github.com/yourusername/yourusername.github.io.git
git push -u origin main
# If updating existing repository
git add .
git commit -m "Convert to Jekyll portfolio"
git push origin main
https://yourusername.github.ioThis repository includes a pre-configured GitHub Actions workflow for automated deployment. The workflow file is located at .github/workflows/deploy.yml.
Automatic Setup:
gh-pages branchWorkflow Features:
To Enable:
# Development on main branch
git add .
git commit -m "Update portfolio content"
git push origin main
# Deploy when ready
git checkout gh-pages
git merge main
git push origin gh-pages # This triggers deployment
Workflow Configuration:
name: Deploy Jekyll to GitHub Pages
on:
push:
branches: [ gh-pages ]
# Removed main/master triggers to prevent automatic commits
# Deployment only happens on manual merge to gh-pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
run: bundle exec jekyll build --baseurl "$"
env:
JEKYLL_ENV: production
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
environment:
name: github-pages
url: $
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Create a CNAME file in the root directory:
yourdomain.com
Add these DNS records with your domain provider:
For apex domain (yourdomain.com):
Type: A
Host: @
Value: 185.199.108.153
Value: 185.199.109.153
Value: 185.199.110.153
Value: 185.199.111.153
For www subdomain:
Type: CNAME
Host: www
Value: yourusername.github.io
In _config.yml, update:
url: "https://yourusername.github.io" # or your custom domain
baseurl: "" # leave empty for user pages
Edit _data/profile.yml with your information:
baseurl in _config.yml_layouts/default.htmlbundle exec jekyll build locally# Check Ruby version
ruby --version
# Update Bundler
gem update bundler
# Clean and reinstall
bundle clean --force
bundle install
# Build site without serving
bundle exec jekyll build
# Build with verbose output
bundle exec jekyll build --verbose
# Clean generated files
bundle exec jekyll clean
# Check for configuration issues
bundle exec jekyll doctor
Add to _config.yml:
plugins:
- jekyll-sitemap # SEO
- jekyll-feed # RSS feed
- jekyll-compress-images # Image compression
GitHub Pages automatically sets appropriate cache headers.
bundle update
bundle update
git add Gemfile.lock
git commit -m "Update dependencies"
git push
```bash
bundle exec jekyll serve –livereload
bundle exec jekyll build
bundle exec jekyll clean
bundle update
bundle exec jekyll doctor