From charlesreid1

Revision as of 12:54, 26 April 2018 by Admin (talk | contribs) (Created page with "To use git for static content deployment: * Use the <code>gh-pages</code> branch to hold all of the web content * Use the <code>master</code> or <code>source</code> branch to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To use git for static content deployment:

  • Use the gh-pages branch to hold all of the web content
  • Use the master or source branch to hold the files needed to generate the static content

When you have content on your gh-pages branch, deploy it on your live machine using the following git clone command:

git -C /www/example.com clone --separate-git-dir=git -b gh-pages <git-repo-url> htdocs

This will create the following directory structure:

/www/example.com/
        htdocs/
            index.html
            ...
        git/
            ...

This keeps your .git out of your htdocs directory.

I also like to clone a copy of the source next to htdocs and git, so that /www/example.com/example.com-src is a copy of the master or source branch.