Just thought I would add to this...
If you are using a custom domain name, you can simply put the favicon.ico
file in the root and browsers will find it. For example if your custom domain is something.domain.com
the favicon will be in the root and available where browsers expect it at something.domain.com/favicon.ico
.
However, if you're not using a custom domain, your repo content will be available at username.github.io/repo-name/
. If you add a favicon to this repo the favicon is available at username.github.io/repo-name/favicon.ico
, but the browser will look for it at in the root domain at username.github.io/favicon.ico
.
But!! You can put a favicon at username.github.io/favicon.ico
by creating a repo named username.github.io
. If the repo has this exact name GitHub pages will automatically be turned on and the content available at username.github.io
, kind of like your GitHub home page!
Then if you put a favicon here, all of your GitHub Pages (without custom domains) will automatically use this favicon.
https://github.com/orgs/community/discussions/63631
Note: This also works for organizations.