how to setup octopress if you already have one in github? - jekyll

this is my blog hosted in github.
http://john-qin.github.io/
now, i want to setup octopress on my ubuntu 12.04. I followed the instruction on this page.
http://octopress.org/docs/deploying/github/
I got stuck after "rake setup_github_pages". this instruction is for setting up brand new environment for octopress. I already have it in github. how do I pull the existing one? and where should I put them?

Octopress repositories have two branches, source and master. The source branch contains the files that are used to generate the blog and the master contains the blog itself.
When the local folders are initially configured according to the Octopress Setup Guide, the master branch is stored in a subfolder named _deploy. Since the folder name begins with an underscore, it is ignored when you git push origin source. Instead, the master branch (which contains your blog posts) gets updated when you rake deploy.
To recreate the local directory structure of an existing Octopress blog, follow these instructions.
First you need to clone the source branch to the local octopress folder.
git clone -b source git#github.com:username/username.github.com.git octopress
Then clone the master branch to the _deploy subfolder.
cd octopress
git clone git#github.com:username/username.github.com.git _deploy
Then run the rake installation to configure everything
gem install bundler
rbenv rehash # If you use rbenv, rehash to be able to run the bundle command
bundle install
rake setup_github_pages
It will prompt you for your repository URL. Enter the read/write url for your repository
(For example, 'git#github.com:your_username/your_username.github.com)
You now have a new local copy of your Octopress blog. Check out this post for more information.

Related

Jekyll Website won't load

I've been trying for a while to get a Jekyll website running on Github Pages, but it doesn't seem to work. I've been getting the error
Your site is having problems building: The symbolic link
/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/ext/ffi_c/libffi-x86_64-linux-gnu/include/ffitarget.h
targets a file which does not exist within your site's repository. For
more information, see
https://help.github.com/articles/page-build-failed-symlink-does-not-exist-within-your-site-s-repository/.
I have already tried it with 9 different Jekyll themes, but none of them seem to work, so I'm clearly doing something wrong. Here are the steps that I am taking
1) Create a new repo and put the files from a Jekyll Theme there, OR fork it from another repo (e.g. https://github.com/iwiedenm/jekyll-theme-massively-src)
2) Git pull it into my computer and make sure I'm on the gh-pages branch
3) Run bundle install --path vendor/bundle
4) Make sure it was built with bundle exec jekyll serve
5) Once it looks good, upload it into Github
git add *
git commit -m 'Test'
git push
Then I go to the repo in the browser and I see the error above, and I can't see the website because of that missing "ffitarget.h" file. When I go look for it in that directory, I am able to find it, but Github doesn't seem to be able to find it.
Nick Shu
PS: Feel free to mark this as a duplicate. I have seen other pages, such as this and I tried it, but it didn't work.
Github page will use local gems in vendor. If you commit them, you will have errors each time github pages tries to resolve symbolic links.
From a fresh repository
Add vendor/** in your .gitignore file before you do a git add . *.
The dot in git add . * forces git to stage dotfiles (.gitignore, ...).
From an already existing repository containing gems in a vendor folder
Add vendor/** in your .gitignore file,
Remove vendor/ files from versioning, git rm --cached -r vendor/
You can now stage, commit and push
git add . *
git commit -m 'remove vendor from versioning'
git push origin master`
Notes :
you can publish master branch content, as gh-pages branch is no more mandatory. See documentation.
unless you have special needs like debuging, it's not necessary to download gems for each of your project. You can just do a bundle install.
Ensure the vendor/bundle/ directory has been excluded..
By default, Jekyll excludes that directory and therefore, it would not care about the contents in your vendor directory..
When you fork/clone a repo, there's a possibility that the exclude: list has been customized (therefore overriding the default setting). You can ensure vendor/bundle/ is ignored by Jekyll by adding it to your custom exclude list:
# Exclude list
exclude:
- README.md
- Gemfile
- Gemfile.lock
- node_modules
- gulpfile.js
- package.json
- _site
- src
- vendor
- CNAME
- LICENSE
- Rakefile
- old
- vendor/bundle/
To locally emulate how the site is built on GitHub Pages, you can build using the --safe switch:
bundle exec jekyll serve --safe

Can github-pages work with only a .md, no .html no jekyll, like gist.github?

Gist.github displays .md files with 0 effort on my part.
Can github pages do that too -- no user html, no jekyll ?
https://github.com/blog/2289-publishing-with-github-pages-now-as-easy-as-1-2-3 says
Create a repository (or navigate to an existing repository)
Commit a Markdown file via the web interface, just like you would any other file
Activate GitHub Pages via your repository's settings
And that's it
...
We'll use your README file as the site's index if you don't have an index.md (or index.html)
But this doesn't seem to work, or I've misunderstood.
Has anyone else tried this flow ?
Symptom:
Your GitHub Pages site is currently being built from the /docs folder in the master branch
Your site is published at https://denis-bz.github.io/test-gh-pages/
hangs -- 404, hours later.
Master/docs under https://github.com/denis-bz/test-gh-pages
looks ok, to a git dummy;
the same .md renders fine on
gist.github .
What didn't work:
git --version
# git version 2.2.1
echo "# test-gh-pages `isotime`" > README.md
touch .nojekyll docs/.nojekyll
git init
git add README.md .nojekyll docs/.nojekyll docs/Gish.md
git commit -m "docs/Gish.md `isotime`"
# github.com/new test-gh-pages
git remote add origin https://github.com/denis-bz/test-gh-pages.git
git push -v --set-upstream origin master
master/docs/index.md alone, with no index.html and no .nojekyll, works:
# github.com/new: make a new repo test-gh-pages
mkdir docs
cp -p .../my.md docs/index.md
echo "# test-gh-pages `isotime`" > README.md
git init
git add README.md docs/index.md
git commit -m "docs/index.md `isotime`"
git remote add origin https://github.com/<user>/test-gh-pages.git
git push -v --set-upstream origin master
# github.com/<user>/test-gh-pages settings: GitHub Pages master branch /docs
# (don't forget save)
Your GitHub Pages site is currently being built from the /docs folder in the master branch
Apparently this calls
Jekyll to turn the docs/index.md into .html
for browsers to display (in a hidden cache ? on-the-fly ? don't know).
After 10 minutes you should see
Your site is published at https://<user>.github.io/test-gh-pages/
See also
is-there-a-command-line-utility-for-rendering-github-flavored-markdown
: grip .
Thanks, GitHub support.

MEAN stack hosting on OpenShift

I'm trying to set up a MEAN stack per the instructions at http://learn.mean.io/#mean-hosting-mean-openshift. I'm new to OpenShift and MEAN (and pretty new to Git), so I'm confused about steps 5 and 6. When it says "Clone that repo to your local computer where your mean.io app codebase is" in step 5, does that mean that I should have installed (init mean) MEAN first? Because if I do that and then try to clone my OpenShift repo to the directory, I understandably get an error that the destination path already exists and is not an empty directory (because the MEAN install is already there). And then in step 6 is says to 'merge my completed local app into this new repo.' Is my 'completed local app' the MEAN install? My understanding is that I would have had to create a Git branch (from an existing repo) to merge anything. Thanks!
5. On your new app’s console page on Openshift, make a note of the git repo where the code lives. Clone that repo to your local computer where your mean.io app codebase is.
6. Merge your completed local app into this new repo. You will have some conflicts, so merge carefully, line by line.
By 'mean.io app codebase', the article is assuming that you already have an application written using mean.io. It is requesting that you git clone the new application you created on openshift to your local machine. Then, merge your mean.io application code into this cloned repository.
The cloned repository contains all of the necessary code to run mean.io on openshift. You simply need to import your code into this repository and push it back to openshift. If you have not written any code, just start writing your code in the cloned repository.

publishing multiple git repos with gitweb

Have just started using git. Building and installing it was easy. Then I went into the directory of one of my web projects and added a git repo to it.
$ cd ~/Sites/webapp
$ git init (and so on)
I also set up gitweb, and when I added ~/Sites/webapp to $projectroot setting in gitweb.cgi, that appeared in my browser when I went to http://localhost/gitweb/gitweb.cgi
My question is thus -- from what I understand, git doesn't have a central repo concept. Every project that I may be working on will have its own git repository. Since my projects are all over my hard disk, their respective repos are also all over the hard disk. How do I add multiple repositories to gitweb? Is there some kind of central registry of all my repos? Should I really rejig how I work, and move all my projects to a central directory? How is this done?
Better late then never I guess.
I solved it by creating a project root directory and linking the git repositories.
project_root="/opt/gitweb"
In /opt/gitweb
ln -s ~/Sites/webapp webapp.git
ln -s ~/someotherplace/whereitis/application appliation.git
I do this by creating an empty repository and linking to the repositories I want to browse. This workaround is necessary because of the complicated way instaweb runs gitweb and sets the project root.
git init instaweb
cd instaweb
ln -s ~/projects/gitproj1 gitproj1
ln -s ~/projects/gitproj2 gitproj2
git instaweb --httpd webrick
The server is up and running now and the homepage will list a .git project (which is the empty repository you just initialised) along with the two actual projects you linked to.

Locally building and pushing jekyll site to github pages

I am using the gem "jekyll-assets" on my site and it fails when pushing to github pages. I have read that a way around this is to build the site locally, which builds just fine, and then push it to github pages. The examples of people doing this, however, are using a project repository and they are pushing the site to a "gh-pages" branch. I am doing this site for myself and the setup for this suggests using the master branch under the repo .github.io. How do I push a local jekyl build to a site with this setup?
You need to push only the content of the _site folder. Nothing else, nor the folder itself.
If you are setting up a project site, push the content to the gh-pages branch. If it's your user website, the repo must be named username.github.io and your site root needs to be the master branch.
Let me know how it goes! :)
Hope to have helped!
Here a windows batch file that pushes generated files back to github. Name it site_publish.bat and put it into the root of your project.
#echo off
cd /d "%~dp0"
rmdir _site /s /q
call jekyll build
git --git-dir=.git --work-tree=_site add --all
git --git-dir=.git --work-tree=_site commit -m "autogen: update site"
git --git-dir=.git --work-tree=_site push
You may want to try jgd command line, which automates all the steps suggested by other answers, in one simple call:
$ jgd
The site will be packaged and then deployed to the gh-pages branch of your repo, provided you have all permissions configured. More about it in this blog post of mine: Deploy Jekyll to GitHub Pages