The issue was getting
Could not find gem 'github-pages' in rubygems repository https://rubygems.org/ or installed locally.
output when I was trying to execute bundle exec jekyll serve
This was because github-pages supports jekyll v3.9 but I had jekyll v4.2.
So I downgraded jekyll: