编程语言
首页 > 编程语言> > javascript – 以编程方式为存储库启用Github Pages

javascript – 以编程方式为存储库启用Github Pages

作者:互联网

有没有办法通过api启用Github页面?
不请求页面构建,我的意思是初始启用该功能并指向分支.

解决方法:

您只需将内容推送到远程git存储库即可.
您必须区分用户页面(username.github.io)和项目页面(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

标签:javascript,github,github-pages,github-api
来源: https://codeday.me/bug/20190627/1305019.html