如何在Github上发布页面? [英] How to publish pages on Github?

查看:315
本文介绍了如何在Github上发布页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git add。看起来很简单,我正在阅读很多内容,但我遇到了问题。 
git commit -m文档改进
git push -u原始大师
git push -u原点gh页面

错误:src refspec gh-pages确实不匹配任何。
错误:未能将部分参考推送到'https://github.com/danielfpedro/simple-modal
.git'

我缺少什么?

解决方案

这个文档可能会有所帮助。即:

1)退出当前的回购并创建新的克隆:



  cd .. 
git clone https://github.com/danielfpedro/simple-modal.git simple-modal-webpage



2)创建一个gh-pages分支(没有任何父母)并从工作目录和索引中删除所有内容:



  cd简单模式网页
git结帐--orphan gh-pages
git rm -rf。



3)添加内容并按下



  echo我的GitHub页面> index.html 
git add index.html
git commit -a -m第一页提交
git push origin gh-pages

在您推送至 gh-pages 分支后,您的项目页面将以 danielfpedro.github.io/simple-modal



4)删除克隆文件夹( simple-modal- ( simple-modal ),并将分支 gh-pages 拉到原始仓库中:



  cd .. 
rm -r简单模式网页
简单模式
git fetch --all
git checkout -b gh-pages origin / gh-pages #New git just use - > git checkout gh-pages



5)就是这样,现在你有另外1个分支 GH-页。使用它为github网页提交更改:



  git checkout gh-pages 
<对文档进行的更改>
git add。
git commit -m文档改进
git push -u来源gh-pages


Looks simple, I'm reading a lot about but I'm having issues to do it.

git add .
git commit -m "documentation improvements"
git push -u origin master
git push -u origin gh-pages

error: src refspec gh-pages does not match any.
error: failed to push some refs to 'https://github.com/danielfpedro/simple-modal
.git'

What I'm missing?

解决方案

this documentation might help. ie:

1) Get out of current repo and make a fresh clone:

cd ..
git clone https://github.com/danielfpedro/simple-modal.git simple-modal-webpage

2) Create a gh-pages branch(without any parents) and remove all content from the working directory and index:

cd simple-modal-webpage
git checkout --orphan gh-pages
git rm -rf . 

3) Add content and push

echo "My GitHub Page" > index.html
git add index.html
git commit -a -m "First pages commit"
git push origin gh-pages

After your push to the gh-pages branch, your Project Page will be available at danielfpedro.github.io/simple-modal

4) Delete the cloned folder(simple-modal-webpage) and pull the branch gh-pages in original repo(simple-modal):

cd ..
rm -r simple-modal-webpage
cd simple-modal
git fetch --all
git checkout -b gh-pages origin/gh-pages   #New git just use --> git checkout gh-pages

5) that is it, now you have 1 more branch gh-pages. use it to commit changes for github webpage:

git checkout gh-pages
<made changes to documentation>
git add .
git commit -m "documentation improvements"
git push -u origin gh-pages

这篇关于如何在Github上发布页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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