The tutorial in
haroopress.com explains only how to publish to
git. However, I have site with hosting account not with github.com. Hence, I should publish manually by using
While I am searching web, I found a page which is requesting the method to publish using rsync, but no solution appeared.
So, I tried to figure out how to publish using
rsync with my hosting account. Here is the way I used.
Modified I have added
--delete option to
Important Hosting account MUST support ssh service.
And, you must know the target directory where the site pages are published into.
$ ssh <account>@<domain> Password:
My case: target directory is www.
Note The target directory name varies by hosting company, e.g.,
$ make gen
(many lines are omitted)
The site HTML sources are placed in _public directory.
Using rsync and ssh:
$ rsync -acvz -e ssh _public/ <account>@<domain>:<target_path>
$ rsync -acvz --delete -e ssh _public/ <account>@<domain>:<target_path>
The options used above:
My case: <target_path> is www/.
(many lines are omitted)
rsync uses to detect files' changes by comparing
date and size of files by default. However, haroopress always generates new files from source files after clearing the _publish directory. If file's date is used for detecting file change, rsync always puts all files including nothing changed. It causes unnecessary transfer. To solve this, we use
checksum instead of file date and size.
Checksum can distinguish the modified files among all newly generated files.
Modified Note About
--delete option: If you change file or directory name of page, post, or slide in original data path (source/data/...) and publish with rsync without --delete option,
the files or directories before change still exist in the hosting account. Hence, the site is massed up with garbage pages and exposes unwanted pages and old link to others. rsync with
--delete option can provide you up-to-date site by removing old files. But if you have other pages nothing related to pages generated by haroopress, you MUST not use
Ensure the site files are published successfully. Login again into hosting account, then check.
You can put the command into executable script file.
Create rsync_deploy.sh using any kind of editor.
The content of rsync_deploy.sh:
#!/bin/sh rsync -acvz -e ssh _public/ <account>@<domain>:<path>
#!/bin/sh rsync -acvz --delete -e ssh _public/ <account>@<domain>:<path>
After create the file, give execution permission:
$ chmod +x rsync_deploy.sh
After that, just two commands are needed:
$ make gen $ ./rsync_deploy.sh