Deploying a GitHub repository to Cloudways is straightforward, thanks to Cloudways’ built-in Git integration. Here’s a step-by-step guide:
—
Step 1: Log in to Cloudways
- Log in to your Cloudways account.
- Select the server and application where you want to deploy your GitHub repository.
—
Step 2: Enable Git Integration
- Navigate to your application.
- Go to the Deployment via Git tab on the application management dashboard.
—
Step 3: Generate an SSH Key
- Click Generate SSH Keys (or use your existing SSH key if applicable).
- Copy the public SSH key displayed.
—
Step 4: Add the SSH Key to GitHub
- Log in to your GitHub account.
- Navigate to the repository you want to deploy.
- Go to Settings > Deploy Keys.
- Click Add Deploy Key.
- Paste the public SSH key from Cloudways.
- Check the box for Allow write access if necessary (e.g., for subsequent updates or pull requests).
- Save the key.
—
Step 5: Configure Git Deployment
- Back in Cloudways, enter the Git Remote Address (your repository’s SSH URL, e.g.,
git@github.com:username/repository.git
).
- Specify the branch you want to deploy (e.g.,
main
or master
).
—
Step 6: Deploy the Code
- Click Start Deployment.
- Cloudways will pull the code from your GitHub repository and deploy it to your application’s public directory.
—
Step 7: Verify Deployment
- Check your application directory using SSH or SFTP to confirm the files are deployed.
- Test the application URL to ensure the code is working correctly.
—
Step 8: Set Up Automatic Deployment (Optional)
If you want Cloudways to automatically deploy changes whenever you push to your GitHub repository:
- Use a GitHub webhook to trigger Cloudways deployments.
- Follow the Cloudways guide for setting up webhooks, as their platform supports this feature.
—
Tips for Success
- Ensure the repository contains only the files necessary for deployment (e.g., no local config files).
- If your project uses environment variables, set them up in Cloudways using their Application Settings.
Would you like further assistance with specific deployment steps or configurations?