Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to publish pages on Github?

Tags:

github

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?

like image 962
Daniel Faria Avatar asked Apr 18 '14 00:04

Daniel Faria


2 Answers

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
like image 65
suhailvs Avatar answered Nov 16 '22 02:11

suhailvs


Have you set up a new "orphan" branch in your repository? If not do this from your repository:

git checkout --orphan gh-pages

And create some content:

echo "Sample" > index.html
git add index.html
git commit -a -m "Sample page"
git push origin gh-pages

Now you should see your page (after some minutes).

like image 26
Sebastian Avatar answered Nov 16 '22 00:11

Sebastian