6

Is there any way to enable Github pages through the api? Not requesting a page build, I mean the initial enabling of the feature and pointing to a branch.

  • i want to do the same but i am using master, not gh-pages. the api wont let me update page information if github pages isnt already enabled. what can i do?: https://developer.github.com/v3/repos/pages/#update-information-about-a-pages-site – wolfram77 Sep 24 '18 at 05:16

1 Answers1

4

You just have to push content to the remote git repository.
You have to differentiate between a User-Page (username.github.io) and a Project-Page (username.github.io/projectname)

User-Page:

git clone https://github.com/username/username.github.io
cd username.github.io

echo "Hello World" > index.html

git add --all
git commit -m "Initial commit"
git push -u origin master

Project-Page:

git clone https://github.com/user/repository.git
cd repository

git branch gh-pages
git checkout gh-pages
echo "Hello World" > index.html

git add --all
git commit -m "Initial commit"
git push -u origin gh-pages
Borian
  • 622
  • 10
  • 19