Are Github pages created automatically in the fork of a repo which has a gh-pages branch?
Asked Answered
C

7

41

Are github pages within my account created automatically when I fork a repo which already includes gh-pages branch?

Chuch answered 21/12, 2011 at 9:7 Comment(2)
Why don't you just try it? I believe the pages should be created automatically, since your fork will have a gh-pages branch too, but you will have to wait 10 minutes after the fork before being sure, since there's some lag in creation of the pages.Haystack
I tried it already yesterday, but when I access the website it shows the instruction page although the gh-pages branch is there and it works in original repo.Chuch
C
49

There needs to be at least one push to trigger a page build so by doing a git push origin master, I got the page to rebuild.

Chuch answered 21/12, 2011 at 15:36 Comment(2)
In my case I had to switch to the gh-pages branch.Maximilian
This didn't trigger a build of the GitHub Pages site for me in my fork of a repo with a gh-pages branch.Menagerie
T
23

An elegant approach:

git push -f origin gh-pages^:gh-pages
git push origin gh-pages:gh-pages

git push origin master might not be good because if there might already be something on master. The above should always work, as it just wobbles the remote branch back and forward.

Taken from: Pushing without committing , whose solutions are also solutions to this question.

Triadelphous answered 10/7, 2014 at 19:0 Comment(4)
I get this error after the last command: error: src refspec gh-pages does not match any. But it seems to me that the first command was already enough.Lux
@Lux do you have the gh-pages branch locally? USERNAME.github.io repos are magic and generate GH Pages on master.Triadelphous
I just realized it worked anyway. So it seems that the first command git push -f origin HEAD^:gh-pages was already enough.Lux
@Lux Note that the first command, by itself, effectively reverts the last commit on the gh-pages branch (for the copy of the repo on Github).Menagerie
E
5

Forking a repository within Github is not sufficient by itself to trigger the creation of the Github Pages.

Either of these two things will work:

  1. Edit and save any page using the Github interface. For example, modify the README.md file, even just adding a space.
  2. Make any kind of git push to the gh-pages branch. As others have suggested, a trivial non-change you can make is:

    git push -f origin origin/gh-pages^:gh-pages
    git push origin origin/gh-pages:gh-pages
    

This force-pushes the penultimate commit to be the gh-pages HEAD, then fixes it.

Environs answered 24/4, 2016 at 5:4 Comment(0)
T
4

After you fork a github page repo, you can change any file on github page and commit it, your web site will appear without using git.

Taka answered 27/2, 2014 at 15:31 Comment(2)
Not even close to what he asked !Evy
I believe that the poster is saying that the fastest way to get your pages loaded is to use the Github in-browser editor on any file in the forked repo. Once you save/commit your changes there, the page-build for the gh-pages should be triggered. You thus don't even need to clone the repo to local ("without using git") for that to happen. Just note that it seems to be necessary to make an edit specifically on gh-pages branch for it to work.Patinous
T
1

Renaming the forked repository would work too.

Terpineol answered 4/1, 2016 at 12:10 Comment(0)
S
0

No, after you fork a repo, you have to publish it again. To do this, run the following commands on a local clone:

git push -f origin origin/gh-pages^:gh-pages
git push origin origin/gh-pages:gh-pages

This triggers the publisher hook twice, but you don't have to commit anything.

Schwenk answered 18/1, 2016 at 13:0 Comment(0)
H
0

You would have to publish it afresh from your forked repo directory Run:

git push origin main

Hesperidium answered 8/2, 2023 at 10:42 Comment(1)
This is a duplicate answerShoemake

© 2022 - 2024 — McMap. All rights reserved.