How to Connect GitHub and Deploy Git Projects with xCloud

Updated November 26, 2026 · 14 min read

Summarize with:
Share:

This guide shows server owners and team administrators how to connect GitHub to xCloud, deploy a new Git project, add Git to an existing WordPress or Custom PHP site, recover when a deploy key cannot be configured automatically, disconnect a site from Git so you can delete a Git provider, and reconnect a site you disconnected. GitHub connections are scoped to an xCloud team, so selecting the correct team before connecting or deploying determines which GitHub App installation the server and site use.

Prerequisites

  • An xCloud account with permission to manage the target team, server, and site
  • A provisioned xCloud server owned by that team
  • Access to the GitHub account or organization that owns the repository
  • Permission to install or approve the xCloud GitHub App for that GitHub account or organization
  • For a new Git deployment, a reachable repository containing the project
  • For Git setup on an existing site, a reachable empty repository selected for the xCloud GitHub App
  • The branch name, domain, runtime requirements, web root, and any required environment values

Understand GitHub connection ownership

A GitHub connection belongs to the currently selected xCloud team. A server and its sites use the GitHub connection associated with the team that owns the server.

The same GitHub organization can be connected to more than one xCloud team. Each team connection is independent: disconnecting the organization from one xCloud team does not disconnect it from another team.

Before connecting GitHub or starting a deployment, use the team switcher to select the team that owns the target server.

Step 1: Connect GitHub to the correct xCloud team

  1. In xCloud, select the team that owns the target server.

    Expected result: The team name in the dashboard header matches the server owner.

  2. Go to Settings → Integrations → Git Provider.

    Expected result: The Git Integration page lists the team’s existing connections or shows the option to connect a provider.

The Git Integration page under Settings, Integrations, Git Provider, listing the team’s connections and the Connect Git Provider button

  1. Select Connect Git Provider.

  2. Choose GitHub, enter a recognizable label, and select Connect GitHub. GitLab and Bitbucket are marked Coming Soon in the current interface.

    Expected result: xCloud redirects you to GitHub to install or authorize the xCloud GitHub App.

The Connect Git Provider dialog with GitHub selected, a label field and the Connect GitHub button; GitLab and Bitbucket marked Coming Soon

  1. In GitHub, choose the account or organization, then choose one access scope:

    • All repositories gives the App access to every current and future repository in that account or organization.
    • Only select repositories limits the App to the repositories you choose. Return to the GitHub App installation settings later if another repository must be added.
  2. Approve the installation and return to xCloud.

    Expected result: The connection appears on the Git Provider page under the current xCloud team.

Access rule: A repository omitted from an Only select repositories installation will not be available to xCloud, even if the same GitHub organization is connected successfully.

Step 2: Deploy a new Git project

  1. Open the target server and start Deploy via Git from the new-site flow.

  2. Select the connected GitHub provider and repository, or enter a public repository URL where the flow allows it.

    Expected result: xCloud can read the repository and branch list. For a private repository, the repository must be included in the GitHub App installation.

  3. Select the deployment branch and review the detected application type.

  4. Review the deployment settings before creating the site:

Setting What to enter
Site User The Linux user that owns and runs the site files. Review the generated value and edit it when your naming convention requires a different user.
Domain The production or temporary domain for the site.
Web root / Build output directory The directory that the web server should serve. Use the framework’s public or build output directory rather than the repository root when required.
Environment file directory The subdirectory where xCloud should create the .env file. Leave it empty to use the site root.
Push to deploy Enable this to deploy on every push. A push to any branch of the repository starts a deploy of the selected branch.
Deploy script Optional commands to run after xCloud pulls the repository.
  1. Add application secrets and environment values in xCloud rather than committing a .env file to Git. When writing deployment commands, the interface supports xCloud variables such as XCLOUD_PHP,XCLOUD_NODE, and PROJECT_DIR. To see which .env files a deploy keeps and how to stop tracking one you already committed, read Environment Variables (.env) and Git Deployments.

  2. Select Save and Deploy to save the reviewed settings and start deployment in one action.

    Expected result: xCloud creates the site, configures repository access, and starts the first deployment. The deployment log should progress instead of stopping at repository access or deploy-key setup.

Step 3: Add Git to an existing WordPress or Custom PHP site

Use this flow when the site already exists in xCloud and you want xCloud to place its current files under Git without recreating the site.

  1. Confirm that the destination GitHub repository is accessible to the connected GitHub App and is empty.

    Expected result: xCloud can complete its preflight checks. Setup does not begin if the repository cannot be reached or already contains content.

  2. Open the site, then select Git in the site navigation.

  3. If xCloud asks for a connection, select Manage Git Providers, connect GitHub to the server’s owning team, and return to the site.

The Git tab of an existing site asking for a connection, with the Manage Git Providers link

  1. Select the connected GitHub App installation and the empty repository presented by the setup flow.

  2. Review the generated .gitignore. Keep environment files,.env.* variants,/.htpasswd, caches, and other sensitive or generated files excluded. Removing those defaults can commit secrets or password hashes to the repository.

  3. Confirm the setup.

    Expected result: xCloud creates the initial commit from the current site, configures the deploy key and webhook, and enables push-to-deploy after setup completes.

Step 4: Recover from a deploy-key setup failure

A private repository needs a deploy key before the site can clone or pull it. If xCloud cannot add the key automatically, the deployment stops before cloning and shows recovery instructions. This prevents a deployment from continuing with incomplete repository access.

  1. Open the affected site and select Git.
  2. In Deploy Key Required, select Generate Deploy Key or Re-register Deploy Key, as shown.

The Deploy Key Required panel with Generate Deploy Key, the SSH public key to copy, and Verify Connection

  1. If xCloud displays an SSH Public Key for manual setup, copy the complete displayed key.

  2. In GitHub, open the repository and go to Settings → Deploy keys → Add deploy key. Paste the displayed public key and save it.

  3. Return to xCloud and select Verify Connection.

    Expected result: Verification succeeds, the Deploy Key Required panel clears, and deployment controls become available.

  4. Review the Git branch, web root,.env file directory, pull script, and deploy script. If the site was cloned, also check for a warning that a copied script still references the source site’s path.

  5. Save the settings, then start the deployment. Where available, use Save and Deploy to do both in one action.

Step 5: Disconnect Git and delete a Git provider

You can’t delete a Git provider while a site still deploys from it. Disconnect each of those sites from Git first, then delete the provider. Disconnecting changes nothing on the server: the site keeps serving the code it already has, and its files stay exactly as they are. xCloud keeps the site’s Git settings, so you can undo it later with Reconnect Git (see Step 6).

If you try to delete a provider that is still in use, xCloud refuses and names the sites, for example: “This provider is still connected to 1 site(s): example.com. Open each site’s Git settings and choose Disconnect Git, then delete this provider again. Disconnecting does not touch the site’s files.”

  1. Open the site named in that message, then select Git in the site navigation.
  2. Scroll to the Disconnect Git card at the bottom of the page and click Disconnect Git.

Click ‘Disconnect Git’ on the Disconnect Git card at the bottom of the site’s Git page

  1. In the Disconnect Git? dialog, click Disconnect Git to confirm.

The Disconnect Git? confirmation dialog with the Disconnect Git button

Expected result: xCloud shows “Git disconnected. The site and its files were not changed.” The site no longer deploys from its repository, and push to deploy stops. xCloud also removes the site’s deploy key and webhook from the GitHub repository when it can reach GitHub. The site’s Git page then shows a Reconnect Git card. On a WordPress site, a Custom PHP site or a One Click app that runs without Docker, the card sits above the Setup Git Integration form, where you can connect another repository instead (see Step 3). Laravel, Node.js, Docker and other Git-deployed sites show only the Reconnect Git card. 4. Repeat steps 1 to 3 for every site the message named. 5. Go to Settings → Integrations → Git Provider and click the delete icon in the provider’s Actions column.

Click the delete icon in the Actions column on the Git Provider page

Expected result: the provider is removed from the list.

When Disconnect Git is refused:

  • “A deployment is in progress for this site. Disconnect Git once it has finished.” Wait for the deployment on the site’s Deployments page to finish, then try again.
  • “The repository is still being set up for this site. Disconnect Git once it has finished.” Wait until the Git setup from Step 3 completes, then try again.
  • “Another action is running for this app. Try again when it finishes.” This applies to a One Click app that runs without Docker: another task is already running on it. Wait for it to finish, then try again.
  • The card shows “Ask a team admin with the deploy-settings permission to disconnect Git.” and no button. Disconnecting stops a site’s deploys, so it needs the same permission as changing the deploy script. Ask the team owner, or an admin who has it. See who can change a deploy script.

If xCloud could not reach GitHub when you disconnected, the deploy key and webhook may still be on the repository. Remove them in GitHub under the repository’s Settings → Deploy keys and Settings → Webhooks. Removing them stops the repository from calling a site that no longer deploys from it.

Developers can do the same through the Public API or xCloud MCP: see Disconnect a site from Git.

Step 6: Reconnect a site to Git

Reconnect Git undoes a disconnect. It puts back the repository, branch and Git provider the site had when you disconnected it, so the site deploys from that repository again. Nothing changes on the server and nothing deploys until you deploy. It works for every site type, including Laravel, Node.js and Docker sites, which have no other way to connect a repository after a disconnect.

  1. Open the site, then select Git in the site navigation.

    Expected result: the Reconnect Git card shows the Repository and Branch that will be restored, and the Git Provider when the site used a connected provider. On a WordPress site, a Custom PHP site or a One Click app without Docker, the card sits above the Setup Git Integration form.

Click ‘Reconnect Git’ on the Reconnect Git card of the site’s Git page, which shows the repository and branch to restore

  1. Click Reconnect Git.

    Expected result: xCloud shows “Git reconnected. The site deploys from <repository> again.” and opens the Git Settings page with the same repository and branch.

  2. When you want the site to deploy, click Deploy Now, or push to the repository if push to deploy is on.

After Reconnect Git, the Git Settings page shows the same repository and branch; click ‘Deploy Now’ to deploy again

After the reconnect, xCloud also puts back what the disconnect removed from the repository:

  • Deploy key: for a private repository, xCloud adds the site’s deploy key (the same key as before) back to the repository. A public repository needs none.
  • Push to deploy: if the site had a push-to-deploy webhook on GitHub, xCloud creates it again.

After a reconnect, the Git Settings page can show a Finish reconnecting this site card. For a private repository, it first says the deploy key is being added back, and it updates by itself. If GitHub did not allow the deploy key or the webhook to be put back, the card lists the step left for you. The repository and branch are already back and Deploy Now works:

  • Deploy key: add the site’s deploy key to the repository, then click Verify. Use Show the deploy key to jump to it.
  • Push to deploy: click Generate a URL to jump to the Deployment URL card, click Regenerate URL (Generate URL if the site never had one) and confirm, then copy the new URL and the Webhook secret and add them as a webhook in your repository (content type application/json). The URL is shown only once. Open the repository’s webhooks takes you there on GitHub.

Expected result: each step on the Finish reconnecting this site card closes by itself once it is done, and the card goes away when no step is left.

When Reconnect Git is refused:

  • “A deployment is in progress for this site. Reconnect Git once it has finished.” Wait for the deployment to finish, then try again.
  • “Another action is running for this app. Try again when it finishes.” This applies to a One Click app that runs without Docker: another task is already running on it. Wait for it to finish, then try again.
  • “A repository is being set up for this site. Reconnect Git once it has finished.” Wait for the Git setup from Step 3 to finish. If it completes, the site is already connected to that new repository.
  • “The Git provider this site deployed with has been removed, so this connection cannot be restored.” The saved connection used a provider that was deleted. On a WordPress site, a Custom PHP site or a One Click app without Docker, connect a repository with Step 3. Other site types need a new site from Step 2.
  • “The Git provider “<label>” is not connected. Reconnect it under Git Providers, then reconnect this site.“ The saved provider lost its connection to GitHub. Open Settings → Integrations → Git Provider, where that provider usually shows a Re-auth badge. For a provider connected with OAuth, click the Re-authorize to restore connection icon in its Actions column and approve xCloud on GitHub. For a provider connected as a GitHub App, click Manage repositories on GitHub in its Actions column and repair the installation there. Then click Reconnect Git again.
  • The card shows “Ask a team admin with the deploy-settings permission to reconnect Git.” and no button. Reconnecting turns the site’s deploys back on, so it needs the same permission as disconnecting. See who can change a deploy script.

If the site’s Git page shows no Reconnect Git card, xCloud has no earlier connection saved for that site. On a WordPress site, a Custom PHP site or a One Click app that runs without Docker, the page shows only the Setup Git Integration form, so you can connect a repository with Step 3. On a Laravel, Node.js, Docker or other site, the page shows an error instead: “This site is not connected to a Git repository. Connecting an existing site to a repository is available for WordPress sites, Custom PHP sites and OneClick apps that run without Docker.” To deploy that project from Git, create a new site with Step 2.

Developers can reconnect through the Public API or xCloud MCP too: see Reconnect a site to Git.

Git pull script and deploy script (advanced)

In this step, you can customize how your application pulls code from your Git repository and define actions to run after deployment.

Available Variables

You can use the following variables in both Git Pull Script and Deploy Script:

Project variables (all sites)
• PROJECT_DIR — absolute path to your site root
• XCLOUD_SITE_PATH — absolute path to your site root
• XCLOUD_SITE_BRANCH — current Git branch used for deployment

PHP variables (PHP sites only)
• XCLOUD_PHP_VERSION — PHP version (e.g. 8.2)
• XCLOUD_PHP — full path to PHP binary
• XCLOUD_COMPOSER — PHP-prefixed Composer path

Node.js variables (all sites)
• XCLOUD_NODE — path to Node.js binary
• XCLOUD_NODE_VERSION — installed Node.js version
• XCLOUD_NPM — path to npm binary

PM2 variable (Node.js sites only)
• PM2_PROCESS_NAME — the PM2 process name for the site

Git Pull Script

The Git Pull Script allows you to control how the code is fetched from your Git repository during deployment. You can go to the ‘Git Pull Script’ section and enter your custom script. If you leave this field empty, xCloud will use the default pull process.

Deploy Script

The ‘Deploy Script’ runs after your code is successfully pulled from the repository. To access this, make sure the “Run this script after every site deployment” option is turned on. Enter your scripts under the ‘Deploy Script’ section.

After configuring your scripts, click on the ‘Save Changes’ button to continue.

Options and settings reference

Option Behavior
GitHub App: All repositories Makes all repositories in the selected GitHub account or organization available to this App installation.
GitHub App: Only select repositories Makes only the selected repositories available. Add access in GitHub before attempting to deploy another private repository.
Connection label Helps distinguish multiple GitHub connections in one xCloud team.
Git branch The branch xCloud pulls and deploys. With push to deploy on, a push to any branch of the repository deploys this branch.
Enable push to deploy Creates or uses the deployment webhook so a push can trigger deployment.
Environment file directory Controls where xCloud writes the .env file for supported non-WordPress deployments.
Git pull script Overrides the default repository pull commands. Leave it empty to use xCloud’s default.
Deploy script Runs after code is pulled when post-deployment execution is enabled.
Deploy key Gives the site SSH access to a private repository. Public repositories cloned over HTTPS do not require one.

Verification

The integration is ready when all of the following are true:

  • The GitHub connection appears under the team that owns the server.
  • The intended repository appears when that connection is selected.
  • The site’s Git page no longer shows Deploy Key Required.
  • Verify Connection succeeds when manual deploy-key recovery was required.
  • The first deployment completes and the deployment history records it.
  • If push to deploy is enabled, a push to the repository starts a new deployment of the selected branch.
  • The deployed site serves from the intended web root and receives its environment values without a committed .env file.

Troubleshooting

Symptom Likely cause Fix
The repository does not appear The GitHub App uses Only select repositories, and this repository was not granted Open the GitHub App installation settings, add the repository, then refresh the repository list in xCloud.
A connection exists, but the server cannot use it GitHub was connected to a different xCloud team Switch to the team that owns the server and connect or select GitHub there.
Existing-site setup rejects the repository The repository is unreachable or is not empty Grant the App access and use an empty repository for the existing-site setup.
Deploy Key Required remains visible xCloud could not register the key automatically, or the displayed key has not been added to GitHub Add the displayed public key under the repository’s deploy keys, then select Verify Connection.
Deploys fail at Pull latest code after you made the repository private The site still pulls over HTTPS without a login On the site’s Git page, click Switch to SSH with a deploy key. See A public repository that turned private.
Cloning does not begin Deploy-key configuration failed Complete the deploy-key recovery first. xCloud intentionally does not start cloning after this failure.
The deployed page returns a 403 or serves the wrong directory The web root or build output directory points to the wrong location Set it to the framework’s public/build directory, then save and redeploy.
The app starts without required configuration Environment values or the .env file directory are incomplete Add the values in xCloud, confirm the environment file directory, and redeploy. Do not commit secrets.
Deleting a Git provider fails and names one or more sites Those sites still deploy from the provider On each named site’s Git page, click Disconnect Git, then delete the provider again. See Step 5.
After Disconnect Git, the site’s Git page shows only Reconnect Git This is expected for Laravel, Node.js, Docker and other Git-deployed sites Click Reconnect Git to deploy from the same repository again. See Step 6.
A cloned site runs commands against the source path A copied pull or deploy script contains the old site path Replace the source path with the current site path before deploying.

Common mistakes

  • Connecting GitHub while the wrong xCloud team is selected. The connection is team-scoped, not account-wide.
  • Assuming organization access grants every repository. An installation limited to selected repositories exposes only those repositories.
  • Using a non-empty repository for existing-site setup. xCloud checks the repository before setup to avoid overwriting existing history.
  • Continuing after deploy-key failure. Repository cloning is blocked until the key is configured and verified.
  • Removing sensitive.gitignoredefaults. This can expose environment files or basic-auth password hashes.
  • Serving the repository root for frameworks with a public/build directory. This can expose private files or cause a 403 response.
  • Committing.envto Git. Store environment values in xCloud instead.

Frequently asked questions

Can one GitHub organization be connected to multiple xCloud teams?

Yes. Each xCloud team keeps an independent connection. Removing one team’s connection does not remove the others.

Which GitHub connection does a site use?

The site uses a GitHub connection from the xCloud team that owns its server.

Are GitLab and Bitbucket available?

Not in the current connection dialog. They are shown as Coming Soon; GitHub is the available provider documented here.

Why does xCloud need an empty repository for an existing site?

xCloud pushes the site’s current files as the initial repository content. The empty-repository check prevents that operation from colliding with existing Git history.

Does a public repository need a deploy key?

No. Public repositories can be cloned over HTTPS. Private repositories require authenticated access, normally through the GitHub App and a deploy key. If you make a public repository private later, open the site’s Git page and click ‘Switch to SSH with a deploy key’ so deploys keep working.

Why can’t I delete my Git provider?

A provider can’t be deleted while a site still deploys from it. xCloud names those sites. Open each one, go to Git, click Disconnect Git, then delete the provider again.

Does Disconnect Git delete my site or its files?

No. The site keeps serving the code it already has and its files stay as they are. It only stops deploying from the repository, and push to deploy stops.

Can I undo Disconnect Git?

Yes. Open the site’s Git page and click Reconnect Git. xCloud puts back the same repository, branch and Git provider. For a private repository it adds the deploy key back, and if the site had push to deploy on GitHub it adds that webhook back too. Nothing deploys until you deploy.

Does Reconnect Git deploy my site?

No. It only restores the connection. The site and its files are not changed. Click Deploy Now, or push to the repository when push to deploy is on, to deploy again.

If you run into any issues connecting GitHub or deploying, feel free to reach out to our support team.