Skip to content

Instantly share code, notes, and snippets.

@alterebro
Last active May 19, 2016 18:03
Show Gist options
  • Save alterebro/7dd331094f1589432e7f to your computer and use it in GitHub Desktop.
Save alterebro/7dd331094f1589432e7f to your computer and use it in GitHub Desktop.

Harp compiled site deployment to GitHub pages

  • Set up the repository : PUBLIC & initialize the repository with a readme file

  • Clone it and navigate to the repository folder

	$ git clone https://github.com/user/repository
	$ cd repository/
  • Create a special GitHub Pages branch and switch and Remove all files from the old working tree
	$ git checkout --orphan gh-pages // Create new branch "gh-pages"
	$ git rm -rf . 		// [don't forget the dot at the end!] Remove all files in folder
  • Add content and push
	$ echo "readme file" > readme.md
	$ git add readme.md
	$ git commit -a -m "readme file commit"
	$ git push origin gh-pages
  • Make the gh-pages branch your default branch on GitHub. Repository Administration > Options > Set “Default Branch” setting to something other than master

  • Delete the master branch on GitHub (which I think just sends a null branch to replace the remote master branch)

	$ git push origin :master
  • Delete the master branch in your local repo (once you’ve checked everything is working!)
	$ git branch -d master
	$ git branch -D master // -D in case of force
  • Initialize a Harp app
	$ harp init _harp // Init standard harp app
  • Work on your project
	// $ cd _harp/
	// $ harp server
  • Compile your Harp app
	$ harp compile _harp/ ./  // Compile harp app
  • Deploy to GitHub Pages
	// git add -A // Git add changed files
	// git commit -a -m "Harp + Pages commit" // Commit Git changes
	// git push origin gh-pages // Git push changes to repository
  • Load your new GitHub Pages site. Your page can be found at:
	// your-github-name.github.io/repository-name

more :



Deploying a /dist folder to gh-pages

  • Remove the dist directory from the project’s .gitignore if needed.

  • Make sure git knows about your subtree (the subfolder with your site).

	git add dist && git commit -m "Initial dist subtree commit"
  • Use subtree push to send it to the gh-pages branch on GitHub.
	git subtree push --prefix dist origin gh-pages

Source : https://gist.github.com/cobyism/4730490

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment