Github pages and github project sites with personal domain name - github

I successfully moved my blog to github pages(www.strayed-bits.net). However, I cannot access my project site: rmuktader.github.io/bootstrap
Is there a way to make custom domain name work for both github pages and github project sites? Or do I have to forget about personal domain name and stick with rmuktader.github.io?

Well, pointing to rmuktader.github.io/bootstrap leads server to look for rmuktader.github.io/bootstrap/index.html which doesn't exist.
The only thing available at this url (from your last commit) is a folder containing a starter_template folder, but no index.html at the root. So, 404 !
You can move all the starter_template content to your root an commit the changes.
This will send, you will now have your index.html at the root, and everithing will be ok.

Related

Why does GitHub pages now show a 404 error?

Thanks for taking the time to read my first question.
I created an hosted a repo on GitHub assigned it to my name and committed and yesterday I could see the website.
Today it seems to have gone offline with no error and with no other change.
Any help would be massively appreciated.
Site: mylokaye.github.io
Domain: mylokaye.tech
Error:
404
There isn't a GitHub Pages site here.
If you're trying to publish one, read the full documentation to learn how to set up GitHub Pages for your repository, organization, or user account.
GitHub Status — #githubstatus
Solution
One possible solution is to ensure there is a file called CNAME on the branch your GitHub Pages site is served from, containing your custom domain name.
Root cause
When you configure a custom domain in the repo's Pages settings, GitHub generates a CNAME file and commits this to the branch or folder the site is being served from. If this file is removed, you will see a 404 page instead of your site and the custom domain configuration will be blank again.
If you are using something like Docusaurus then when a content change is made and the static site is rebuilt, the CNAME file was being wiped out.
Viewing the commit history for the branch my site was being served from (gh-pages) I saw commits which added a CNAME file to the repo root corresponding to when I configured the custom domain in the repo's Pages settings.
In the screenshot above, the commit on 2nd Jan was generated by GitHub automatically when I configured the custom domain. The commit on 3rd Jan was Docusaurus publishing a content change, which removed the CNAME file and my site returned a 404 on the custom domain url. Same thing happened on 5th Jan when I reconfigured the site and then made a content change and the GitHub Action publishing my site generated the deploy commit which removed the CNAME file again.
Fix for Docusaurus v2
My site is generated by <Docusaurus.io> and I'd missed this in the documentation where it says to create a static file in the /static folder which will be copied over to the published branch. The file contents should be a single line of text with the custom domain name eg. buildthethingright.com
For other site generators there will probably be different ways to ensure a CNAME file with a custom domain remains on the GitHub Pages branch. Note there was a different process for Docusaurus v1, so check your static site generator docs for how to do this for you.
The typical trigger for an error 404 message is when website content has been removed or moved to another URL. There are also other reasons why an error message could appear. These include:
The URL or its content (such as files or images) was either deleted or moved (without adjusting any internal links accordingly).
The URL was written incorrectly (during the creation process or a redesign), linked incorrectly, or typed into the browser incorrectly.
The server responsible for the website is not running or the connection is broken.
The requested domain name can’t be converted to an IP by the domain name system (DNS).
The entered domain name doesn’t exist (anymore).
Check this website, if you want more answer:
https://en.m.wikipedia.org/wiki/HTTP_404#Soft_404

Github Pages with single custom subdomain for multiple repositories (using paths)

I have multiple Github Repositories. By all of them gh-pages are enabled, and the repositories are accessible via paths for example:
username.github.io/repository1,
username.github.io/repository2,
...
Now I'm trying to create a custom subdomain docs.foo.tld and to have all my repositories gh-pages to be accessible via
docs.foo.tld/repository1
docs.foo.tld/repository2
...
I have created a CNAME entry docs.foo.tld to username.github.io
But when I'm adding this custom domain (docs.foo.tld) in repository1 repository settings on github, the gh-pages are directly accessible via docs.foo.tld, not via docs.foo.tld/repository1
How I use all this repositories in the path segments /repository1, /repository2 when using same custom subdomain for all of them.
Also to note, when I try to add this custom subdomain to repository2, I get the exception as the CNAME is already taken.
The CNAME and setting the custom domain should only be done in the .github.io repo.
Other repos should not contain a CNAME and you should not set the custom domain in the other repositories. Those settings are inherited from .github.io repo and setting them in the other repositories is overwriting the root site.
Just delete the CNAME records from the project repos, and remove the custom domain from the settings of the project repos. You may need to add the custom domain name back to the .github.io repo, but after that you should be all setup like you wish.
I had the exact same problem, but with the root account being an Organisation, not a User site (but this makes no difference). The solution is surprisingly simple (I had many trials and errors):
If not yet done, create the special Organisation/User "umbrella" Site as per the doc by creating a git repository called myorg.github.io.
In the Settings of that repo, under the "Pages" tab, choose your custom domain docs.mydomain.com. See picture:
The content of this repo is up to you. Personally I use VitePress with a small script which deploys at the root of the gh-pages branch. The script includes the creation of a CNAME file at the project root, with the content `docs.mydomain.com'
Configure your DNS zone with your Internet Provider by adding a CNAME entry pointing to myorg.github.io. (note the trailing dot – your IP may or may not add it automatically for you).
Return to the Pages Settings of your GitHub umbrella repo, and check that the subdomain is validated (it may take a few minutes).
That's all for the umbrella docs site, whose content contains links to docs.mydomain.com/project1, docs.mydomain.com/project2 etc.
Now, here is the trick: there is no trick. In all of your real projects, simply deploy your documentation. You can do so in the docs subfolder or not, in either branch, that is, in the master or gh-pages one, it doesn't seem to matter.
If any, the docs/ part of the url will be replaced by project1/ etc. There is no need for a CNAME, and no need for another custom subdomain.
Here is the config of one my project:
See how GitHub indicates under which URL the site is published.
Here is my GitHub organisation and its umbrella site
and the results:
https://docs.arcsecond.io
https://docs.arcsecond.io/cli
https://docs.arcsecond.io/oort
Bonus. If by any chance you configure your projects to have sub-subdomains (that's what I tried before finding the solution) – such as https://project1.docs.mydomain.com, the above configuration will also "work". That is, navigating to https://docs.mydomain.com/project1 will redirect you to https://project1.docs.mydomain.com
Internet is kind of amazing, isn't it?

How do I serve a Github page through a custom domain when the content is stored in the docs folder?

I have a project site in Github that is served through a custom domain (rented through Google Domains). I first configured the repository to serve directly from the master branch, and configured the DNS records in Google accordingly.
Specifically, the A record is set to
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
and the CNAME record is set to myusername.github.io. In the Github repository, I created the CNAME file with mycustomdomain.org and changed the repository settings to use it. This works properly.
However, once I change the Github Pages setting to use the /docs folder on the master branch, I can't access the site through mycustomdomain.org. (It's a 404 error) Intuitively, it's now at mycustomdomain.org/docs. Is there any way to both serve the pages from the docs folder and access the site through the top-level domain?
Moving CNAME file from the root of the repo to the /docs folder solved the problem.
Reference: The CNAME errors are mentioned here in GitHub documents.

username.github.io pages not published as github pages

I have Created the repository named as username.github.io and tried to access the same URL in browser but i'm getting 404 error.
Checked in repository settings -> Under Github Pages Section, But it was not showing the message "your site is published at username.github.io"
Apart from this, is there anything i have to do...
Screenshot:
Actual URL: https://username.github.io
To create a GitHub Pages site for your own username (i.e. a personal website and not a website for a repository), you need to replace the username part of username.github.io with your GitHub username. For example, if my username on GitHub is abcde, I would create a repository called abcde.github.io and then enable GitHub Pages in its settings as you have done.
You need select source branch to publish(Initially it will be none. So nothing published) in
Settings -> Github pages --> source and click save. Then only it will be published to username.github.io URL.
Make sure your branch has index.html file.
Normally, github pages URLs are generated as username.github.io/repo-name.
I'm not sure what naming the repo as you did would do, but in most cases, just name the repo as you normally would (a description of the project) and then publish the sites that way. If you already have code, here is how to rename the project in Github and updating the remote url
I'm not sure exactly why your pages aren't generating, but it likely has to do with the name of your repo.

Github Pages: How to access github project page when root site is jekyll

My website is running on Jekyll being hosted at dashedstripes.github.io (which i have rooted to my own domain), I'd like to set up another repository to be a project page i.e dashedstripes.github.io/project-name
I've setup a separate project repo with a gh-pages branch which is saying it is live at dashedstripes.github.io/project-name
However, because the root site is being run on jekyll, I'm being given a 404 whenever trying to access that project.
Is there anyway around this?
For now, you have no index page at the root and you get a 404. If you try http://adamgray.so/what-should-i-eat/dist/, you hit your index.html.
You need to publish dist folder content at the root of your gh-page branch.