How to make GitHub Pages build?

Each GitHub repository can have ( or be ) a GitHub site that can be built with Jekyll. GitHub creates a site every time you click a new commit.
Is there a way to force the Github Pages site to refresh without clicking a new commit?

+80
github-pages
Jun 07 '14 at 15:35
source share
7 answers

From GitHub Support, 2014-06-07:

It is currently not possible to manually start the rebuild without pushing the commit to the appropriate branch.




Edit:

As Andy pointed out in the comments, you can push an empty commit using the command:

git commit -m 'rebuild pages' --allow-empty git push origin <branch-name> 
+126
Jun 07 '14 at 16:34
source share

I had this problem for a while, and switching to myapp.imtqy.com master did not change anything on myapp.imtqy.com for two reasons:

1 - Assembly

No matter how many times I tried to transfer my work to the master, the assembly did not start. I found a workaround by changing my file in the Github online editor (open your index.html and edit it on the Github website, then confirm)

2 - Caching Issues

Even after a successful build, I still see the same page on myapp.imtqy.com , and reloading with Ctrl + Shift + R will not solve this problem. Instead, if you use Chrome, check your page, go to the " Application " tab, select "Clear storage" in the left menu and click "Clear site data" at the bottom of the menu.

+6
Sep 18 '18 at 15:03
source share

An empty commit did not work for me, but based on @benett's answer, this worked for me:

Open Postman, create a new request with this URL: https://api.github.com/repos/[user_name.BIZ/[repo_nameapter/pages/builds (replace it with your name and repo) and select the POST method.

Before starting it, go to the headers tab and add a new Accept key with the value application/vnd.github.mister-fantastic-preview+json

Now you can launch it and visit your pages again.

+4
Dec 19 '18 at 0:23
source share

This is doable starting with the v3 GitHub API, although it is currently in preview https://developer.github.com/v3/repos/pages/#request-a-page-build

 POST /repos/:owner/:repo/pages/builds 
+3
Dec 17 '18 at 23:44
source share

If you want a quick script solution, here it is. Just complete the following tasks only once, and run the script whenever you want to rebuild the GitHub page.

1. Create a personal access token for the command line:

  • Follow official help here to create a personal access token. Essentially, you have to log in to your GitHub account and go to: Settings > Developer settings > Personal access tokens > Generate new token .
  • Tick repo .
  • Copy the token.

2. Create the following script:

  • Create a file called RebuildPage.sh and add the lines:

     #!/bin/bash curl -u yourname:yourtoken -X POST https://api.github.com/repos/yourname/yourrepo/pages/builds -H "Accept: application/vnd.github.mister-fantastic-preview+json" 

    Here

    • Replace yourname with your GitHub username.
    • Replace your yourtoken with your copied personal access token.
    • Replace yourrepo your repository name.

3. Run the script:

  • If you are using Windows 10:

    • You need to configure the Windows subsystem for Linux, if not already done. Follow this to do this.
    • Remove the first line ( #!/bin/bash ) from the script and save the script as RebuildPage.bat . (i.e. replace .sh with .bat in the script file name)
    • Alternative to the above item: to be able to double-click to run the .sh file:

      • Set bash.exe as the default program for .sh files.
      • Open regedit.exe and edit HKEY_CLASSES_ROOT\Applications\bash.exe\shell\open\command . Set the value to (Default) :

         "C:\Windows\System32\bash.exe" -c " \"./$(grep -oE '[^\\]+$' <<< '%L')\";" 
    • Now double-click the script when you want to rebuild your GitHub page. Done!

  • If you are using Linux / Mac, running the script is similar to running other scripts. Done!

Additional notes to the solution:

This solution uses the GitHub REST API v3 preview API. Here is the official API documentation.

+2
Jan 08 '19 at 9:40
source share

Alternative solution

You may have received an email from GitHub stating that Jekyll was unable to create your site when you added it to your gh-pages . If so, you can try to force a push to trigger another assembly.

If you use a dedicated folder for the destination website, say a public folder, you can try rebuilding your folder and adding the folder to your committed changes. After that, you will need to split these files into the gh-pages branch and force them to run another assembly, even if the files have not changed at all. The rest of the code below simply removes the commits for the public folder for convenience and deletes it from the local file system.

The code

 git add public git commit -am ":bug: triggering another jekyll build" git push origin $(git subtree split --prefix public master):gh-pages --force git reset HEAD~1 rm -rf public 

hints

If there are uncommitted changes that are not part of the final site, you can save them using the following command.

 git stash 

Then run the command above to manually force the Jekyll build to unzip them.

 git stash pop 

Recommendations

0
Nov 17 '18 at 18:29
source share

Even after I submitted my changes to the GitHub repository, I could not see the changes today. Then I checked my repository settings for more information, there I could see that the assembly had failed all this time, and for this reason I could not see the changes.

enter image description here

You can also see the message "You have problems creating the site: cannot create the page. Please try again later."

Then I checked my last commits and tried to figure out what was causing this problem. In the end, I was able to solve the problem.

enter image description here

There was an extra comma in the (,) tags , and this caused this problem .

enter image description here

You will not receive corresponding error messages if there is any problem in your .md file. I recommend that you check the build status and compare changes if you encounter the same problem.

0
Jun 16 '19 at 11:07 on
source share



All Articles