Many hosting service now supports not only FTP and web uploading but also SSH. It's more convenient to use the Git flow:
- Modify and test your site locally.
- Push to remote Git repo, which triggers the update of your website.
My settings:
- Suppose the HTTP server use
${HOME}/html
as the root dir of your website. git init
the${HOME}/html
as a Git repo with working dir.git init --bare
the${HOME}/html.git
as a bare repo for push/pull.- Edit
${HOME}/html.git/hooks/post-update
as follows.
rsync
can come handy in cases where your HTML root is a subfolder of Git and the hosting server does not support soft linking well.In my use case,
SRC/
is the subdir in the Git repo.DST
is the dir that the hosting server use for HTTP document root.