From charlesreid1

 
(8 intermediate revisions by the same user not shown)
Line 19: Line 19:
I'll cover both.
I'll cover both.


===Manually Create Branch===
===Option 1: Manually Create Branch===


You want to create the gh-pages branch. Assuming you've already cloned the project, check out the gh-pages branch for the first time as an orphan branch (i.e., totally empty):
You want to create the gh-pages branch. Assuming you've already cloned the project, check out the gh-pages branch for the first time as an orphan branch (i.e., totally empty):
Line 36: Line 36:


<pre>
<pre>
git add .
git commit -am "init commit"
git commit -am "init commit"
git push origin gh-pages
git push origin gh-pages
</pre>
</pre>


Now you can visit your site at <code>http://username.github.io/projectname</code> and see the live content.
Now your site at <code>http://username.github.io/projectname</code> should be empty and ready for Octopress.


===Create Branch with Rake===
===Option 2: Create Branch with Rake===


If you pass a project repository instead of a username.github.io repository, the rake file will know to create a gh-pages branch for the project. To do this, clone your project repository and run the following command in it:
If you pass a project repository instead of a username.github.io repository, the rake file will know to create a gh-pages branch for the project. To do this, clone your project repository and run the following command in it:
Line 49: Line 50:
bundle exec rake setup_github_pages
bundle exec rake setup_github_pages
</pre>
</pre>
'''DON'T FORGET! If the above command doesn't work, it's probably because you aren't using the right ruby, or because you didn't install the Octopress bundle! See [[Octopress/Octopress_with_Github_Personal_Pages#Getting_the_Octopress_Gem_Bundle|the Octopress user page instructions]] for how to do that'''


Then you can create/edit/delete posts and do other things. When you're all done and ready to make the static content, you run:
Then you can create/edit/delete posts and do other things. When you're all done and ready to make the static content, you run:

Latest revision as of 16:30, 21 September 2014

Every project can also create a collection of hosted GitHub pages. To do this, you can create a branch called gh-pages that will be completely separate from your other branches and will contain all of the content served by the web server when you go to the page http://username.github.io/project

The Procedure

Create Local Copy of Project

First thing you'll need to do is clone your project from Github:

git clone https://github.com/charlesreid1/project

Checkout Web Content Branch

Now, web content is served from a special branch in the Github repository, the gh-pages branch. Everything in that branch is hosted by Github pages web servers.

You have a few different options for creating this branch. If you wanted to create and host a couple of pages of your own content, you could manually create a gh-pages branch, as detailed in this guide. Alternatively, you can let rake take care of everything, as detailed in this guide.

I'll cover both.

Option 1: Manually Create Branch

You want to create the gh-pages branch. Assuming you've already cloned the project, check out the gh-pages branch for the first time as an orphan branch (i.e., totally empty):

git checkout --orphan gh-pages

Now make sure there's nothing in the branch already. You can clean it out:

git rm -rf .

and commit changes when ready:

git add .
git commit -am "init commit"
git push origin gh-pages

Now your site at http://username.github.io/projectname should be empty and ready for Octopress.

Option 2: Create Branch with Rake

If you pass a project repository instead of a username.github.io repository, the rake file will know to create a gh-pages branch for the project. To do this, clone your project repository and run the following command in it:

bundle exec rake setup_github_pages

DON'T FORGET! If the above command doesn't work, it's probably because you aren't using the right ruby, or because you didn't install the Octopress bundle! See the Octopress user page instructions for how to do that

Then you can create/edit/delete posts and do other things. When you're all done and ready to make the static content, you run:

bundle exec rake generate

which generates the content, and

bundle exec rake deploy

which deploys it to the right branch of the right repository.

Other stupid stuff you have to do

I don't know why you have to do this, but just do it (see http://octopress.org/docs/deploying/github/):

git remote add origin (your repo url)
# set your new origin as the default branch (whatever that means)
git config branch.master.remote origin