Git Deployment

Deploying Your Website with Git

By the StarDomain teamPublished 3 min read
Knowledge base article
Contents (7 sections)

Deploying from Git means your live site matches a branch of your repository, and every change has a history you can go back to. This guide covers the Git routes on StarDomain.

Key takeaways

Container Hosting: connect your repository in the Git deploy tab, then click Deploy now, or let every push deploy automatically through a webhook. App Platform: connect GitHub or use a deploy token. On both, you do not push to our servers with git push.

1. Container Hosting: the Git deploy tab

Connect your repository

  1. Open your container
    in the client area and go to the Git deploy tab.
  2. Enter the repository address.
    For a private repository, use the SSH address ([email protected]:you/site.git) and add the deploy key shown on the tab to your repository (in GitHub: Settings › Deploy keys).
  3. Choose the branch
    (for example main) and the folder inside public_html to deploy into.
  4. Click Connect.
    A webhook secret is shown once. Copy it now if you want deploy on push.

Deploy

Click Deploy now. The panel fetches your code, takes a backup, then copies the files. This can take a few minutes. Each deploy appears in Deploy history, and you can redeploy an earlier version from there.

Your folder will match the repository

On each deploy, files in the target folder that are not in the repository are removed. wp-config.php, .env, wp-content/uploads and .well-known are never touched, and a backup is taken before every deploy. Keep uploads and secrets out of Git.

Deploy on every push

In GitHub, open Settings › Webhooks › Add webhook. Paste the webhook address shown on the Git deploy tab, set the content type to application/json, enter your webhook secret, and choose Just the push event. In GitLab, use Settings › Webhooks, put the secret in Secret token, and tick Push events. Only pushes to the branch you chose are deployed. If you lose the secret, make a new one on the tab. The old one stops working at once.

2. App Platform

Apps deploy from GitHub (connect the repository and click Deploy Now) or with a deploy token from your own CI. See Deploying from GitHub and Getting Started with the App Platform.

3. VPS

On a VPS you have root access, so you can set up any Git workflow you like, for example a bare repository with a post-receive hook.

4. Good habits

  • Never commit secrets. Keep passwords and keys in .env or wp-config.php, both of which Git deploy leaves alone.
  • Deploy from one branch and do your work on others.
  • Check the site after each deploy. If something breaks, redeploy the previous version from Deploy history.

New to Git? Start with Setting Up Git Version Control for Your Website.

Can I git push directly to my Container Hosting or App Platform service?

No. Container Hosting pulls from your repository (with Deploy now or a webhook), and the App Platform deploys from GitHub or with a deploy token.

Does a deploy delete my WordPress uploads?

No. wp-config.php, .env, wp-content/uploads and .well-known are never touched, and a backup is taken before every deploy.

Can I deploy a private repository?

Yes. Use the SSH address of the repository and add the deploy key shown in the Git deploy tab to your repository.

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
Deploying Your Website with Git