I would like to edit github pages locally, i.e., edit locally as usual and upload changes in the usual way git. How can this be done?

    2 answers 2

    Clone the repository (obviously, but you never know; my repository is used to show https://github.com/v1993/eiforia.git ):

    git clone https://github.com/v1993/eiforia.git 

    Create a local gh-pages branch:

     git branch gh-pages 

    Switch to the newly created branch:

     git checkout gh-pages 

    Mark the branch for tracking (synchronization):

     git branch --set-upstream-to=origin/gh-pages 

    Synchronize HEAD and commits with the remote branch:

     git reset --hard origin/gh-pages 

    Be sure to do everything right:

     git branch -vv 

    The output of the last command should be the line:

     * gh-pages 3d79c21 [origin/gh-pages] Create gh-pages branch via GitHub 

    Instead of "Create gh-pages branch via GitHub" there may be another name if you have already created your commits on this thread.

    • If you create locally, then there seems to be no such commit name. Such a github exposes when creating a branch through its interface. - Nick Volynkin
    • @NickVolynkin, at the end I wrote "Instead of" Create gh-pages branch via GitHub "there may be another name if you have already created your commits on this thread." - val

    Enough to perform

     git checkout gh-pages 

    and git will do the rest of the work for you.