CopyFilesOverSSH@0 - Copy files over SSH v0 task

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

Syntax

# Copy files over SSH v0
# Copy files or build artifacts to a remote machine over SSH.
- task: CopyFilesOverSSH@0
  inputs:
    sshEndpoint: # string. Required. SSH service connection. 
    #sourceFolder: # string. Source folder. 
    contents: '**' # string. Required. Contents. Default: **.
    #targetFolder: # string. Target folder. 
  # Advanced
    #isWindowsOnTarget: false # boolean. Target machine running Windows. Default: false.
    #cleanTargetFolder: false # boolean. Clean target folder. Default: false.
    #cleanHiddenFilesInTarget: false # boolean. Optional. Use when cleanTargetFolder = true. Remove hidden files in target folder. Default: false.
    readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
    #overwrite: true # boolean. Overwrite. Default: true.
    #failOnEmptySource: false # boolean. Fail if no files found to copy. Default: false.
    #flattenFolders: false # boolean. Flatten folders. Default: false.
# Copy files over SSH v0
# Copy files or build artifacts to a remote machine over SSH.
- task: CopyFilesOverSSH@0
  inputs:
    sshEndpoint: # string. Required. SSH service connection. 
    #sourceFolder: # string. Source folder. 
    contents: '**' # string. Required. Contents. Default: **.
    #targetFolder: # string. Target folder. 
  # Advanced
    #isWindowsOnTarget: false # boolean. Target machine running Windows. Default: false.
    #cleanTargetFolder: false # boolean. Clean target folder. Default: false.
    readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
    #overwrite: true # boolean. Overwrite. Default: true.
    #failOnEmptySource: false # boolean. Fail if no files found to copy. Default: false.
    #flattenFolders: false # boolean. Flatten folders. Default: false.
# Copy files over SSH v0
# Copy files or build artifacts to a remote machine over SSH.
- task: CopyFilesOverSSH@0
  inputs:
    sshEndpoint: # string. Required. SSH service connection. 
    #sourceFolder: # string. Source folder. 
    contents: '**' # string. Required. Contents. Default: **.
    #targetFolder: # string. Target folder. 
  # Advanced
    #cleanTargetFolder: false # boolean. Clean target folder. Default: false.
    #overwrite: true # boolean. Overwrite. Default: true.
    #failOnEmptySource: false # boolean. Fail if no files found to copy. Default: false.
    #flattenFolders: false # boolean. Flatten folders. Default: false.
# Copy Files Over SSH v0
# Copy files or build artifacts to a remote machine over SSH.
- task: CopyFilesOverSSH@0
  inputs:
    sshEndpoint: # string. Required. SSH service connection. 
    #sourceFolder: # string. Source folder. 
    contents: '**' # string. Required. Contents. Default: **.
    #targetFolder: # string. Target folder. 
  # Advanced
    #cleanTargetFolder: false # boolean. Clean target folder. Default: false.
    #overwrite: true # boolean. Overwrite. Default: true.
    #failOnEmptySource: false # boolean. Fail if no files found to copy. Default: false.
    #flattenFolders: false # boolean. Flatten folders. Default: false.

Inputs

sshEndpoint - SSH service connection
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.


isWindowsOnTarget - Target machine running Windows
boolean. Default value: false.

Checks if the target machine is running Windows.


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

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


cleanHiddenFilesInTarget - Remove hidden files in target folder
boolean. Optional. Use when cleanTargetFolder = true. Default value: false.

When set to true, removes hidden files in the target folder.


readyTimeout - SSH handshake timeout
string. Required. Default value: 20000.

How long (in milliseconds) to wait for the SSH handshake to complete.


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 This task runs using the following command restrictions: restricted
Settable variables This task has permission to set the following variables: Setting variables is disabled
Agent version 2.206.1 or greater
Task category Deploy
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 This task runs using the following command restrictions: restricted
Settable variables This task has permission to set the following variables: Setting variables is disabled
Agent version 2.182.1 or greater
Task category Deploy
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.144.0 or greater
Task category Deploy
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