以编程方式为存储库启用Github Pages [英] Programmatically enable Github Pages for a repository

查看:53
本文介绍了以编程方式为存储库启用Github Pages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过api启用Github页面? 不要求建立页面,是指最初启用该功能并指向分支.

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.

推荐答案

您只需要将内容推送到远程git存储库即可.
您必须区分用户页面(username.github.io)和 Project-Page (username.github.io/projectname)

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

这篇关于以编程方式为存储库启用Github Pages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆