Create GitHub Page via REST API v3 #24469
-
Hello everyone, is it possible to create a new Github Page through the REST API v3? I tried to use “Request a page build”, but it only works on already existing pages. If I use this endpoint for repositories where no page exists yet, I get this:
Do you have some ideas? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
If you want to enable Pages for a given repository, you have to tell it which branch (and optionally if you want to use the I hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Hey @lee-dohm, thanks for your reply, it sounds very useful! I will try this and keep you updated! |
Beta Was this translation helpful? Give feedback.
-
I tried your solution, but this endpoint also seems to work only with already existing pages. If I create a new repository and upload a new index.html, I get a 404 Not Found at this endpoint. And witch witch value should I send for “cname”? Is it [username].github.io ? |
Beta Was this translation helpful? Give feedback.
-
If the edit endpoint doesn’t offer what you want, then you’ll have to use the UI to initially enable Pages support for the repo. You probably shouldn’t be changing the CNAME value via the API but rather follow the system described in the help. |
Beta Was this translation helpful? Give feedback.
If the edit endpoint doesn’t offer what you want, then you’ll have to use the UI to initially enable Pages support for the repo. You probably shouldn’t be changing the CNAME value via the API but rather follow the system described in the help.