Reference: http://ricostacruz.com/lidoc/manual/guides/uploading_to_github_pages.html
Created
October 14, 2012 01:43
-
-
Save ramnathv/3886937 to your computer and use it in GitHub Desktop.
Pushing Documentation to Github Pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ignore built md and html files in the slides directory | |
slides/*.html | |
slides/*.md | |
slides/fig/* | |
slides/figures/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile | |
GITHUB_REPO ?= yourname/project | |
# Sends the documentation to gh-pages. | |
docs.deploy: docs | |
cd docs && \ | |
git init . && \ | |
git add . && \ | |
git commit -m "Update documentation."; \ | |
git push "git@github.com:$(GITHUB_REPO).git" master:gh-pages --force && \ | |
rm -rf .git | |
.PHONY: docs.deploy |
I can put all generated files in .gitignore. Some prime candidates are the fig
or figure
directory in which knitr
generated figures are stored.
I tried this and it works. Basically it works by initializing the deploy directory as a git repository, pushing it to a remote gh-pages branch (by force) and removing the .git directory so that all history is erased.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this makefile finally clarifies what I had been suspecting all along about how to deploy generated files to github without committing it to the repo. Here is what the makefile does.