Link custom domain to any GitHub repo - github

I am aware that on GitHub you can create a repository, <username>.github.io, which will be a personal website. I also understand you can link custom domains to this, so example.com would show the website in your GitHub repo.
I have a couple questions though.
At the moment, I have a GitHub project - let's call it FooProject. I have purchased a custom domain name for a website to showcase the project. How can I create a website for this, hosted on GitHub? (not a personal site in the form <username>.github.io, but a project site).
Also, can I give the GitHub repository a different name like fooproject.com, or does it something specific?
I suppose what I am really asking is, when hosting a website on GitHub...
Can you host your website using a GitHub repository of any name (like fooproject.com)?
If not, I'm aware of using gh-pages branches for the website of a project. How would this work with a custom domain?
If that isn't a good option either, what's the best option for my use case?
Hope that's clear.

So I managed to answer my own questions in the end - here's what I did.
My website is going to be something to showcase a different project I am working on. I could have hosted the website from a /doc directory or gh-pages branch in my project repository and then set up a custom domain from there.
However, there was also the option of creating a repository with any name and hosting the website from the master branch - this method appealed to me more.
I created a new repository named the same as my domain name, example.com (it doesn't really matter what you call the repository). Then, using git, I added some website files - index.html, stylesheet.css, etc.
Once my repository was ready, I configured its master branch as a publishing source for GitHub pages - see this help page for details.
Then with my DNS provider (GoDaddy, in my case), I configured the CNAME and A records (for the www subdomain and apex domain respectively). There are also help pages on GitHub for setting up www subdomains and setting up apex domains. Note that it takes a little while for the changes made on the DNS to take effect.
Finally, I added my custom domain to my GitHub repository - see the GitHub help page for adding or removing custom domains.
Here's a summary (for using any GitHub repository to host a website):
Create your repository - repository name doesn't matter.
Add your website files - HTML, CSS, JavaScript, etc.
Configure the master branch as a publishing source
Configure CNAME and A records with DNS provider
Add the custom domain to the GitHub repository settings

Related

Jekyll workflow on GitHUB creates website in a subdomain

I created my website using the tutorial available at
https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/creating-a-github-pages-site-with-jekyll
I used /docs as origin of the data and pushed the website as described.
I successfully created the website rosarioiacono.github.io using Jekyll.
Now I wanted to change the name of the website. To do so, I decided to delete the previous repository and start the process again.
I deleted the repository and removed the origin.
I then started the process trying to create the website datagronomist.io, but at the end, what I get is a website with the address https://rosarioiacono.github.io/datagronomist.github.io/
I would need some help to do that.

Error 404 when I tried to access my website

Recently I tried to make a website using HTML and CSS and then I tried to host it on GitHub by commit under a repository name myname_examp.github.io, but when I tried to access it through the web browser using myname_examp.github.io there was an error 404.
Is there some steps to do?
If your Github account is free tire, the Github pages repo must be public.
If you are using GitHub Enterprise Cloud and has access control, the site can only be accessed by people with read access to the repository where the site is published from.
You can use actions status to check whether your site ready:
See more on Github docs
BTW, if your site is project type (repo not named user/org.github.io), you shall go to repo setting enable pages.

Github page version number syntax

I have a github repo that is also a github page. I use it as a CDN like so:
https://agentscript.org/src/Model.js
(agentscript.org is a CNAME forwarder to backspaces.github.io/agentscript/)
I would like to access the code by release number. So for example something like:
https://agentscript.org#0.9.0/src/Model.js
Is there a way for me to do this? The above fails. Maybe a different syntax?
Note that npm publishing allows this to work on npm based CDNs like skypack or unpkg:
https://unpkg.com/agentscript#0.9.0/src/Model.js
https://cdn.skypack.dev/agentscript#0.9.0/src/Model.js
GitHub Pages doesn't offer a feature like this. The reason is that GitHub Pages is designed to host a personal website or a site for your open source project, but isn't designed to be a CDN. The documentation outlines that there are limits, so if you need a CDN, you need to host your project on an actual CDN.

Github pages with custom sub-domain doesn't redirect to sub-domain

I have a personal blog site hosted on github pages. I've updated the repository settings and DNS settings according to offical document. Unfortunately redirection doesn't work properly, access to original github URL is not forwarded to my sub-domain but top domain name. What's going wrong?
My github page repository is skyscribe.github.io and in the project setting, I've set the custom domain as www.skyscribe.me; now when I navigate to skyscribe.github.io, it just redirects to skyscribe.me than www.skyscribe.me.
EDIT: I have setup my CNAME in DNS resolver properly.
You will need to add a CNAME file.
Also I just checked, it seems to be redirecting to www.skyscribe.me

Custom domain name for github project page

I have a jekyll blog hosted on my github account and I have attached a domain to it http://blog.myname.com
I also created a github page for one of my repositories, it is hosted by github as this my-github-username.com/github-page
My question is how can I attach a new domain name to my repository, like when I goto myrepo.com it will show my repo's github page.
Thanks
For that you need to change CNAME record of myrepo.com point into my-github-username.com/github-page
For detail config please look at this link github
And i think this link also help you to set goal How GitHub Pages sites use custom domains