Octopress/Octopress with Github Project Pages/Attic: Difference between revisions
From charlesreid1
(Created page with "Every project can also create a collection of hosted GitHub pages. To do this, you can create a branch called <code>gh-pages</code> that will be completely separate from your oth...") |
m (moved Octopress/Octopress with Github Project Pages/Old Crap to Octopress/Octopress with Github Project Pages/Attic) |
||
| (13 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Every project can also create a collection of hosted GitHub pages. To do this, you can create a branch called <code>gh-pages</code> 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 <code>http://username.github.io/project</code> | Every project can also create a collection of hosted GitHub pages. To do this, you can create a branch called <code>gh-pages</code> 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 <code>http://username.github.io/project</code> | ||
=The Procedure= | |||
==Create Local Copy of Project== | |||
First thing you'll need to do is clone your project from Github: | |||
<pre> | |||
git clone https://github.com/charlesreid1/project | |||
</pre> | |||
==Checkout Web Content Branch== | |||
Now, web content is served from a special branch in the Github repository, the <code>gh-pages</code> 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 <code>gh-pages</code> branch, as detailed in [https://help.github.com/articles/creating-project-pages-manually this guide]. Alternatively, you can let rake take care of everything, as detailed in [http://octopress.org/docs/deploying/github/ 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): | |||
<pre> | |||
git checkout --orphan gh-pages | |||
</pre> | |||
Now make sure there's nothing in the branch already. You can clean it out: | |||
<pre> | |||
git rm -rf . | |||
</pre> | |||
and commit changes when ready: | |||
<pre> | |||
git add . | |||
git commit -am "init commit" | |||
git push origin gh-pages | |||
</pre> | |||
Now your site at <code>http://username.github.io/projectname</code> 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: | |||
<pre> | |||
bundle exec rake setup_github_pages | |||
</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: | |||
<pre> | |||
bundle exec rake generate | |||
</pre> | |||
which generates the content, and | |||
<pre> | |||
bundle exec rake deploy | |||
</pre> | |||
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/): | |||
<pre> | <pre> | ||
git | git remote add origin (your repo url) | ||
# set your new origin as the default branch (whatever that means) | |||
git config branch.master.remote origin | |||
</pre> | </pre> | ||
[[Category:Octopress]] | |||
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