询问VSTS发布环节是否支持SSH推送WordPress仓库至wpengine
Pushing WordPress Repo from VSTS to WP Engine via SSH
Hey there, let's break down how to get your WordPress repository from VSTS (now officially Azure DevOps) pushed to WP Engine using SSH. The bad news is VSTS doesn't have a built-in, dedicated task for WP Engine deployments via SSH—but the good news is we can use existing tasks and scripts to make this work smoothly.
Option 1: Use VSTS's Built-in SSH Task
VSTS has a native SSH task that lets you run commands directly on a remote server. Here's how to set it up for WP Engine:
- Create an SSH Service Connection:
- Go to your VSTS project >
Project Settings>Service Connections>New service connection>SSH. - Fill in WP Engine's Git server details:
- Server URL:
git.wpengine.com - Username: Your WP Engine Git username (found in your WP Engine dashboard under Git settings)
- Authentication method: Choose SSH key (recommended) and upload your private key (make sure the corresponding public key is added to your WP Engine account).
- Server URL:
- Go to your VSTS project >
- Add the SSH Task to Your Release Pipeline:
- In your release pipeline, add an
SSHtask from the task library. - Select the SSH service connection you just created.
- In the
Commandsfield, enter the Git push command tailored to your setup:# If you need to initialize the repo connection first (one-time setup) git remote add wpengine git@git.wpengine.com:your-account-slug/your-site-slug.git # Push your branch (WP Engine typically uses master for production) git push wpengine your-vsts-branch:master - Note: If you're using VSTS's hosted agents, double-check that WP Engine's Git server is accessible from their network. If you hit connectivity issues, switch to a self-hosted agent that can reach WP Engine.
- In your release pipeline, add an
Option 2: Use Git Tasks with SSH Key Authentication
If you prefer working directly with Git commands in VSTS, you can configure SSH key auth via secure files:
- Store Your SSH Private Key in VSTS:
- Go to your VSTS project >
Pipelines>Library>Secure files>+ Secure file. - Upload your private SSH key (the one paired with the public key in WP Engine).
- Go to your VSTS project >
- Add Tasks to Your Release Pipeline:
- First, add a
Download secure filetask to pull your private key onto the agent machine. - Then, add a
Command linetask to set up SSH auth and push the repo:# Start the SSH agent eval `ssh-agent -s` # Add your private key to the agent ssh-add $(Agent.TempDirectory)/your-private-key-filename.pem # Add WP Engine as a remote (if not already configured) git remote add wpengine git@git.wpengine.com:your-account-slug/your-site-slug.git # Push your code git push wpengine your-vsts-branch:master
- First, add a
Critical Notes to Avoid Headaches
- WP Engine Prep: Make sure you've already enabled Git access for your WP Engine site and added your public SSH key to your WP Engine user account.
- Sensitive Files: Don't include
wp-config.phpor database credentials in your VSTS repo—keep these on the WP Engine server directly (they're managed separately in their dashboard). - Branch Mapping: WP Engine uses specific branch conventions (usually
masterfor production,stagingfor staging sites). Double-check your branch names match what WP Engine expects.
内容的提问来源于stack exchange,提问作者MaxRev17
相关产品推荐
相关产品推荐

