Add a free Cloudflare SSL certificate to your GitHub pages custom domain.
Create a free Cloudflare account and login. Add new site and scan the server, Cloudflare will return two name server addresses.
Go to your domain registrar admin panel and add Cloudflare nameservers.
Next, on Cloudflare under DNS tab add your CNAME an A records in DNS menu in CloudFlare then click on status.
Next, under Crypto tab add set Flexible SSL mode.
Next, under Page Rules tab add these two regex patterns:
Last step, go to your GitHub pages repository settings and set custom domain name.