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.
No you can't. Github Pages does not support dynamic sites.
GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs the files through a build process, and publishes a website.
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)
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With