共用方式為


CopyFilesOverSSH@0 - Copy files over SSH v0 task

Copy files or build artifacts to a remote machine over SSH.

Inputs

sshEndpoint - SSH endpoint
string. Required.

The name of an SSH service connection containing connection details for the remote machine.

  • The hostname or IP address of the remote machine, the port number, and the user name are required to create an SSH service connection.
  • The private key and the passphrase must be specified for authentication.

sourceFolder - Source folder
string.

The source folder of the files to copy to the remote machine. When empty, the root of the repository (build) or artifacts directory (release) is used, which is $(System.DefaultWorkingDirectory). Use variables if files are not in the repository. Example: $(Agent.BuildDirectory).


contents - Contents
string. Required. Default value: **.

The file paths to include as part of the copy. Supports multiple lines of minimatch patterns. The default value is **, which includes all files (including sub-folders) under the source folder.

  • Example: **/*.*(jar|war) includes all .jar and .war files (including sub-folders) under the source folder.
  • Example: "** \n !**/*.xml" includes all files (including sub-folders) under the source folder, but excludes xml files.

targetFolder - Target folder
string.

The target folder on the remote machine, where files will be copied. Example: /home/user/MySite. Preface with a tilde (~) to specify the user's home directory.


cleanTargetFolder - Clean target folder
boolean. Default value: false.

Deletes all existing files and sub-folders in the target folder before copying.


overwrite - Overwrite
boolean. Default value: true.

Replaces existing files in and beneath the target folder.


failOnEmptySource - Fail if no files found to copy
boolean. Default value: false.

Fails if no matching files to be copied are found under the source folder.


flattenFolders - Flatten folders
boolean. Default value: false.

Flattens the folder structure and copies all files into the specified target folder on the remote machine.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.102.0 or greater
Task category Deploy