First, you should create gh-pages branch that special branch of GitHub.
You can find and create it in setting page of you project by the button Automatic page generator.
The branch will map to the doamin http://username.github.io/project/

So the path should be stylesheets/main.css not /stylesheets/main.css

Answer from emn178 on Stack Overflow
🌐
GitHub
github.com › orgs › community › discussions › 22495
CSS not being applied in pages :/ · community · Discussion #22495
We often have people write in to tell us that their CSS was working fine until they added a custom domain to their repository. One way to prevent many of these types of issues is to use relative paths, but some site builders do use the full URL as a base path, so you may need to change a setting or two. ... For Jekyll sites, edit _config.yml. If values are set for baseurl or url variables, we recommend deleting these lines entirely. This will allow GitHub Pages to detect and configure the ideal baseurl and url values in the background, automatically adjusting for changes to your site’s custom domain.
Discussions

CSS not working on GitHub Pages
When I open the html file locally from my computer, everything looks fine but when I open it on Github pages, it’s missing the css styles and the images. Basically it looks like a plain html skeleton website. I made my path to the stylesheet relative to my html file but I can’t figure out ... More on discuss.codecademy.com
🌐 discuss.codecademy.com
1
0
February 22, 2022
My css isnt working on github pages
It's looking for the CSS at /styles.css, when it should be at /yashify/styles.css. I fixed the link via dev tools and then it rendered correctly. normalize.css is also affected. Pro tip: I found the issue immediately using the Firefox dev tools "Network" tab, which showed a 404 error when trying to load the stylesheet. More on reddit.com
🌐 r/github
5
1
June 21, 2023
git - css not working on github pages - Stack Overflow
I can't get my CSS to show on the site. I really can't figure out what I'm doing wrong here, I'm very new to all of this so I'm sure there's something I just can't see. here is the live site http... More on stackoverflow.com
🌐 stackoverflow.com
GitHub Pages doesn't use updated CSS file
I’m using GitHub Pages for my website at this specific site: https://ludomath.net/LA/vectors.html. The problem is that whenever I push new files on GitHub, the CSS files do not update on the site. ... More on github.com
🌐 github.com
16
56
🌐
GitHub
docs.github.com › en › pages › setting-up-a-github-pages-site-with-jekyll › adding-a-theme-to-your-github-pages-site-using-jekyll
Adding a theme to your GitHub Pages site using Jekyll - GitHub Docs
Navigate to the publishing source for your site. For more information, see Configuring a publishing source for your GitHub Pages site. Create a new file called /assets/css/style.scss.
🌐
GitHub
github.com › collections › github-pages-examples
Collection: GitHub Pages examples · GitHub
Fine examples of projects using [GitHub Pages](https://pages.github.com). The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
🌐
aregsar
aregsar.com › blog › 2019 › how-to-customize-your-github-pages-blog-style-in-five-minutes
How to customize your github pages blog style in five minutes | aregsar
March 12, 2019 - After I pushed this change to the remote repository, I refreshed the page and did a view source in the browser to verify that jekyll converted the markdown to the following html: ... Aside: You can see that the text set to the id attribute of the h1 tag is the transformed display text of the tag, where the space character is replaced by a dash and the text is lowercased. To override the default theme style we need to add a local assets/css/style.scss file to our repository.
Find elsewhere
🌐
freeCodeCamp
forum.freecodecamp.org › html-css
How to get my CSS file to show on github website - HTML-CSS - The freeCodeCamp Forum
May 10, 2022 - Hello, I have made a file in Visual Studio Code named pathtoyourstylesheet.css. See below. But, the style is still not showing on my github. It DOES however show when I do f5 in visual studio code. Any reason why? Thanks (:
🌐
Codecademy Forums
discuss.codecademy.com › get help › git
CSS not working on Github pages - Git - Codecademy Forums
October 2, 2019 - I’m working on the Excursion project from the Git and publishing to Github pages. (https://www.codecademy.com/paths/learn-how-to-build-websites/tracks/finishing-touches-and-publishing-a-website/modules/git-and-publishing-to-github-pages/projects/f1-excursion) When I check my code locally the HTML and CSS code pop up and the code works fine.
🌐
freeCodeCamp
forum.freecodecamp.org › t › github-pages-not-linking-to-css › 85262
Github pages not linking to CSS - The freeCodeCamp Forum
February 8, 2017 - I’m attempting to link this site up to the css: https://if-apps.github.io/simple-website-template/ I’ve done this: . I know that should work, but it just isn’t. It’s in the CSS folder, linking to the sheet. The same goes for bootstrap. Here is the repo: https://github.com/IF-Apps/s...
🌐
Reddit
reddit.com › r/github › css not being applied in github pages?
r/github on Reddit: CSS not being applied in github pages?
August 30, 2022 -

I am a newbie and Im trying to create a tribute page but after I deployed my site, the css isnt being applied.

The code worked fine in codepen, Ive googled it and tried a few solutions but I am so confused. I linked the css file to my html file using

<link rel="stylesheet" href="css/style.css">

I also tried href=styles.css

No idea if there is another way to link it 😖

🌐
HUGO
discourse.gohugo.io › support
CSS broken on GitHub pages - support - HUGO
October 3, 2022 - Hello, I can not solve the problem by modifying base url in config file. I am using this repo to create my academic website. locally, website is working fine, but theme not working when deployed on github pages. git…
🌐
GitHub
docs.github.com › en › pages › getting-started-with-github-pages › what-is-github-pages
What is GitHub Pages? - GitHub Docs
GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs the files through a build process, and publishes a website.
🌐
Jekyll Talk
talk.jekyllrb.com › help
CSS working locally but not in production on Github Pages - Help - Jekyll Talk
September 15, 2021 - Hi all, I have the familiar problem that my CSS isn’t loading in production, but works locally. I see that this issue is fairly common but I’ve not been able to work out what code to change. I’ve looked at a few post on…
🌐
SitePoint
sitepoint.com › general web dev
Referencing CSS and JS file in Github Pages? - General Web Dev - SitePoint Forums | Web Development & Design Community
May 19, 2019 - The html is appearing here: https://coding24765.github.io/mymusicgadget/ How would I get the CSS and Javascript to appear also? https://github.com/coding24765/mymusicgadget I’ve never used git hub, or git hub pages before. There’s a way to do it, I don’t know how it’s done though.