Why does my GitHub page not update its content?
Asked Answered
G

33

92

I've been following the official guide @ pages.github.com

So far I've created the local repo and pushed it to GitHub, but, whatever change I do, I can see it in my repo at GitHub but not in my GitHub page. How is that possible?

Gree answered 12/7, 2014 at 12:51 Comment(7)
Did you push your changes to the gh-pages branch? Only that branch will be rendered to the GitHub page… (And that might take up to 10 minutes)Pampas
Well... I followed the instructions... I think is the main branch... Do i have to create the gh-pages one?Gree
I don't think you must use gh-pages. According to official document, gh-pages is used for project site only, and user site like blog is supposed to use master.Ruff
Also, try opening the site in an incognito window (or clear your cache) - In my case, it was serving a cached version even though the site was updated.Dryasdust
as Knut already pointed out - it can take some time until the update is rendered...Osithe
as @LeviFuller pointed out, caching can be a problem. Though in chrome, you can get around caching problems by opening your inspector, then right-clicking on the refresh button, and picking "empty cache and hard reload".Triumph
Also, as of 7-5-2019, github posts a little green checkmark next to "master" and "gh-pages" branches in the "branch" panel to indicate if it has built the current version.Triumph
M
65

A bit late to the party but I just had this issue and my solution isn't covered by any of the above.

Specifically my issue was the following:

  • I had created a github.pages site with a custom domain.
  • I was pushing commits to the correct GitHub branch but not seeing the updates on the github.pages site.

Solution: The issue turned out to be my browser caching the page (despite my having page caching disabled). To fix it I just cleared my cached data from the past hour and that worked instantly.

To clear the cache data in Chrome go to the Chrome menu then More Tools > Clear Browsing Data.

I don't know what caused the caching, this github.pages/custom domain combo is the only thing that has ever caused it for me.

Mckibben answered 22/11, 2017 at 20:3 Comment(1)
it is ironic that with disable cache in network tab in dev tools didn't work, but right clicking the reload button and choosing empty cache and reload workedNardone
V
34

Sometimes this happens to me too: after creating and pushing the gh-pages, the GitHub Pages page is missing or not getting updated. Even if I commit more changes to the branch and push it again, it won't update on GitHub pages.

If I remember correctly, I solve this by deleting the branch from the server and pushing it again:

git push origin :gh-pages
git push origin gh-pages

I might have to add some dummy commits and push again to trigger the update, I don't remember exactly...

Variant answered 12/7, 2014 at 13:0 Comment(5)
Thanks for this - it's the only way I could figure out what was wrong. When I re-created the branch, github then notified me that the problem was that a submodule couldn't be updated, so I removed it as a submodule and committed the files it contained instead. But it never gave me any errors before recreating the gh-pages branch, it just wouldn't update.Hecker
I have having this issue after my first push was successful to gh-pages. Following your instructions fixed it for me.Sizzle
If I try the first command, I get errors like error: unable to delete 'gh-pages': remote ref does not exist error: failed to push some refs toLoading
for those who got error"error: unable to delete 'gh-pages': remote ref does not exist error: failed to push some refs to" may need to go to setting in github and change this Default Branch(left hand side Branch tab), to another branch first. Or create Master branch in github and set it as default.Budd
This fixed the problem in my case. No extra commits were necessary, only: git push origin :gh-pages, then wait until the page returns 404, then git push origin gh-pages. That is, assuming gh-pages is the branch used for GH Pages - which is the default.Antonioantonius
L
23

I had the same issue.

The problem was that my website was publishing from the gh-pages branch, but I was pushing my recent changes to the master branch.

Check which branch Github is publishing your website from. In your repository, click on Settings, scroll down the page and there should be a box where you you can change the publishing branch.

It should look like this:

More info is here

Also if you are using a custom domain name, make sure your CNAME file is up to date.

Hope that helps!

Lithiasis answered 5/10, 2016 at 23:39 Comment(1)
For me as well, I simply switched to the right branch for deployment, and then it workedIrina
P
19

I fixed this problem.

you can try to go to the setting page.

I go into the project settings page (.../settings/pages) ,and found Github pages give me some message "some syntax error", I fixed it, and ok.

Postremogeniture answered 2/12, 2016 at 9:45 Comment(0)
R
17

Try to push empty commit like this

$ git commit --allow-empty -m "Empty commit"

Works like a charm for me every time.

Rhinehart answered 5/4, 2019 at 12:28 Comment(0)
R
9

To solve this issue

  1. Switch your current Github Pages branch to some other branch and click on Save
  2. Switch back to your desirable Github Pages branch and click on Save.

This will force Github to update your changes.

Registry answered 18/11, 2017 at 16:18 Comment(1)
This one worked nicely for me, after trying many of the solutions above. In your repo go to Settings > Pages > Source, and select and save the desired branch. I named mine "switchable" for future use. For creating a new branch on GitHub, go to your repo's code tab, and open the "Switch branches or tags" button, then enter the name for your new branch, and click on the "create..." appearing text.Latreese
P
7

Experienced this problem when a filename contained the word "vendor" ex.:vendor.bundle.20d44fcf5147c6ed68a3.js

Adding an empty file named .nojekyll in the root of the repository fixed the issue.

Jekyll now ignores the vendor and node_modules directories by default https://github.com/blog/2277-what-s-new-in-github-pages-with-jekyll-3-3

Pesade answered 8/11, 2016 at 18:53 Comment(1)
Nowadays you can ask GitHub to use the docs subdirectory of the branch to host the page, and I needed a .nojekyll in there also, not just the root of the branch. Thanks for this.Noninterference
M
7

I am a novice and please allow me to answer with tears. Please go to settings at your repository, scroll down to enter image description here to check WHETHER THERE IS A PROBLEM with your current webpage. If there is a problem, your site WILL NOT BE UPDATED. I think it's a protection mechanism or something.

This morning I deleted and moved some of the files in repository, I have updated many times and it still remains on previous version, even I checked the index.html has indeed updated. Later I shut down the whole repository and started new one, inserting items one by one, but still met the problem. I tried new branch like gh-pages, I think it is not necessary for a beginner like me. Later I checked my settings and found the notification, I deleted the problematic files and it worked instantly. Were I knew the problem I would not have been so stupid to shut down it forever. I miss my old git records. Guess every lesson takes a price, Github is no exception.

Mut answered 30/9, 2019 at 21:16 Comment(0)
B
6

Press ctrl+F5 to re-download cached content.

Bacillary answered 17/11, 2021 at 4:21 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Alyshaalysia
F
5

Try to disable GitHub pages, and enable it after a few minutes. I tried. This works. But It takes some time to update and re-enable GitHub Pages.

Freehearted answered 23/12, 2017 at 20:17 Comment(0)
N
4

I tried Janos' answer but it didn't work for me.

I made a slight change to my index.html file (something insignificant) and pushed to the gh-pages branch again. I tried opening the page in a different browser and it worked. My original browser updated the page too although I don't think it's a browser cache issue.

I rebased master with gh-pages locally and pushed that as well, not sure if that makes any difference.

Nuncupative answered 19/10, 2015 at 15:23 Comment(0)
D
3

I recently had an issue where my github pages hosted site wasn't updating from an old branch push in master. I was able to see the new changes by going to domain.com. (the dot at the end is important), and also hard refreshing would show the new changes, but with a regular refresh, it would show the old site and the old JS files too.

My problem seemed to only be in Chrome, which is where I was developing the site. For full disclosure, the old changes were in React and hosted in Netlify. The new changes that I was trying to get to push and display were static files hosted in github pages.

THE FIX (in Chrome): devtools > Application > clear site data (button).

Discursion answered 6/11, 2019 at 18:12 Comment(0)
B
3

This answer is for those who have created their app with create-react-app.

It took me days to finally find the answer for react-gh-pages not updating. I hope the following answer helps as it did for me. It is a combination of multiple answers that I have researched over:

The main and most common reason is your browsers caching feature. In order to disable it for every rendering of your index.html,

  1. Add this snippet in your index.html file under the public folder.

<meta http-equiv='cache-control' content='no-cache'> 
<meta http-equiv='expires' content='0'> 
<meta http-equiv='pragma' content='no-cache'>
  1. Push any new changes to the master or main branch(not to the origin gh-pages).
  2. By now your master branch is updated.
  3. Now run: git push origin :gh-pages. This will delete the gh-pages branch.
  4. Run: npm run deploy. This will re-build your app and re-create gh-pages branch with updated content.
  5. Now go the settings section on the top-right side of your app repo page. Scroll down to the bottom. Under Github Pages section, under source, there is branch section. Change that to your master branch or main. Keep the root folder as it is.
  6. Go to your site and you will see a Readme file. It may take some time. After a minute or so change the branch back to gh-pages. After a minute visit your site and it should be updated by now.

I hope this helps! Let me know if it worked for you as well in the comment section, cheers!

Bobinette answered 8/4, 2021 at 10:12 Comment(1)
Thank you for this! was stuck for a while and this was the best solution i foundMarenmarena
B
2

If your GitHub pages repo is private AND you have recently downgraded to GitHub Free, this might apply:

Your subscription, GitHub Free, does not support GitHub Pages sites for private repositories. After we introduced free private repositories in January, we found a limited number of sites connected to private repositories were mistakenly left active. If you’d like to keep updating this site, you can make its repository public or upgrade to GitHub Pro. You can also unpublish it below. This site is using a custom CNAME: Secure your domain name before unpublishing this site.

Bocock answered 14/9, 2021 at 10:46 Comment(0)
P
2

In my case it related to an issue in my config file. This showed up on Settings -> Pages. enter image description here

Propertius answered 9/6, 2022 at 16:18 Comment(0)
I
2

If your page was online, but after update no changes visible:

1: Change repository to private

2: Change back to public

3: Enable "GitHub Page" function again

Inadvisable answered 24/6, 2022 at 9:11 Comment(0)
B
2

For those who find solutions above not useful try this:

  • delete "build" directory on your local machine
  • run "npm run deploy" Deleting directory helped me, it will reflect changes on github pages branch, then wait a minute, if you still dont see any changes, try clearing cache or visit your page in incognito

Worked for me.

Burma answered 9/7, 2022 at 0:30 Comment(0)
G
1

Here is what worked for me:

First Step (update your master):

git add . 

git status                # to see the changes to be committed

git commit -m "comments"

git push origin master

Second Step (Update gh-pages):

git-checkout gh-pages     # going to the gh-pages branch

git rebase master         # sync gh-pages with master 

git push origin gh-pages  # commit changes to gh-pages

git checkout master       # return to the master 
Garcon answered 19/7, 2016 at 17:28 Comment(4)
Just a warning: this may work for your project structure, but in some configurations this can really screw you up. Not everybody's gh-pages branch is related to their master branch like this; in fact, Github suggests creating gh-pages as an orphan branch if you aren't using Jekyll.Microcline
When I try to checkout to gh-pages, I get this: error: pathspec 'gh-pages' did not match any file(s) known to git.Loading
#60528576Loading
git-checkout gh-pages is not valid.. you mean git checkout gh-pagesTrott
B
1

I had the same problem everything is up to date in my repository but it still wasn't loading to my github page, so without making any further changes, I tried to add, commit and pull.

I fixed it with another git commit, and git pull again. Now the changes are loaded to my git.

Busk answered 6/4, 2018 at 4:29 Comment(0)
E
1

The easiest way:

Settings -> Braches -> choose "gh-pages" -> UPDATE.

Take mine as example

Exophthalmos answered 11/9, 2019 at 18:55 Comment(1)
In my case, I don't see the github-pages drop-down as seen in your pic. Mine just says unless you specify a different branch. The default branch is set to master. To change this setting, add another branch.Loading
C
1

In my case, it helped to run:

npm run deploy

I did it after pushing the master branch to GitHub. I needed to wait a bit until the changes were visible on my page. But it did work without changing any settings.

Circuit answered 18/9, 2019 at 11:5 Comment(3)
it was working for me but there also need to change in settings as wellByerly
This worked for me, exactly as described above. You can also verify that the deployment was successful, by looking at the 'Actions' tab in Github.Daleth
As mentioned above, you can use an alternative method to verify the deployment: Under the 'Code' tab, select the "gh-pages" branch - then look for a green checkmark and time stamp.Daleth
A
1

In case this helps someone else...

For me the issue was the content in the branch was being updated, but the filenames did not change, so browser was retrieving cached content.

I'm using Angular CLI with angular-cli-ghpages. Setting the configuration to production appends hashes after each file in the build forcing the browser to retrieve the new content.

sample deploy script:

ng build --configuration=production --base-href \"<repo-name>\" && ngh

If you don't want a production build, you can also specify output hashing in other build configurations in angular.json

Avi answered 30/1, 2020 at 22:4 Comment(0)
C
1

If you're using the gh-pages command you may need to delete the gh-pages cache at node_modules/gh-pages/.cache

Corona answered 28/7, 2020 at 18:2 Comment(0)
D
1

The issue is being caused because of the browser caching the page. Open the git link in incognito mode.

Danonorwegian answered 3/10, 2020 at 11:25 Comment(0)
D
1

I reflect my changes in my deployed GitHub repository after committing locally, by renaming my gh-pages branch to master and unpublishing my GitHub Page, and then re-name the branch to gh-pages and then publish it again; then it works.

Dorsiventral answered 20/9, 2021 at 20:43 Comment(0)
I
1

A couple have mentioned looking for error messages in Settings->Pages, but a better place to look is the stdout of the jekyll build workflow under the About tab. In either case, an error message of any sort is best to have in hand before starting on any of the other 26 answers given above.

Instrumentation answered 26/6, 2022 at 16:31 Comment(0)
P
0

After making changes in your script, go down to the commit changes section. There you'll find one input box and one text-area. As you all know filling those boxes is not mandatory, but they are there for a reason. So, next time before clicking on the commit changes button give this a try >> make sure that you write something in the first input box (you can leave the text-area empty), and what you write is different from what you wrote for your last commit for the same file. In this way github will be able to distinguish between the current script and the updated one, and the change should be reflected almost instantly.

Hope that helps.

Perversity answered 25/1, 2019 at 7:17 Comment(0)
I
0

The problem is caused due to browser caching the page. Disable browser caching with meta HTML tags. Add the following in _layouts/default.html

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

WARNING: After this any browser supporting Cache-Control will not store any of your cookies or files.

Idaho answered 7/1, 2021 at 16:30 Comment(0)
M
0

This can happen for various reasons. My issue was that the condition that was tested for during the deploy step didn't match the triggering branch. I had used another script as a model, and it had been trigger from pushes to main. I changed the on: push: at the top to my desired branch, but didn't notice the conditional, so it stayed referencing main

name: Deploy stuff to Pages

on:
  push:
    branches:
      - other-branch # <---- this is my trigger branch

jobs:
  build:
    name: Build

    steps:
      # build steps here

  deploy:
    name: Deploy
    needs: build
    if: github.ref == 'refs/heads/other-branch' # <---- needs to match, was previously 'main'

    steps:
        # deploy steps here
    ```
Menes answered 3/5, 2023 at 9:9 Comment(0)
N
0

Perhaps it's because of errors in one of your codes. That was my case, I saw a red "X" at the left of the commit ID. It won't update your page until the commit has no errors. It has to be a green check at the left of your commit. If you have a red "X" click on it and see the errors you have. solve them and the page will update after you commit without errors.

I show the image below depicting what you need to see (a green check, no errors):

commit with no errors

Numskull answered 5/7, 2023 at 20:54 Comment(0)
A
0

in github pages: in that place we choose the name of our branch ex."main" github give us another option this is "None" choose it and save. after that repeat choose your branch again ex."main" and save wait for afew seconed and update your page it is work with me.for explain

Adaptation answered 15/8, 2023 at 21:31 Comment(2)
Thank you for your interest in contributing to the Stack Overflow community. This question already has quite a few answers—including one that has been extensively validated by the community. Are you certain your approach hasn’t been given previously? If so, it would be useful to explain how your approach is different, under what circumstances your approach might be preferred, and/or why you think the previous answers aren’t sufficient. Can you kindly edit your answer to offer an explanation?Feaster
i just tried and it was work with me it is easy direct and fast for me ,so i just share it.Adaptation
S
-1

Just clear browser's cache. ctrl + shift + r for Chrome, as example

Serrano answered 10/7, 2018 at 19:35 Comment(1)
Please first read the other answers before you post, you probably then noticed this has nothing to do with page refreshes and the answer you give is wrong. Also have a look at the tour: stackoverflow.com/tour and how to write a good answer: stackoverflow.com/help/how-to-answerPrimrose
M
-1

Nothing to worry, to Update your git react code rebuild code by using command

npm run deploy

react code will updated to gh-pages

Mastitis answered 18/2, 2023 at 12:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.