The minimatch pattern for the file patterns option in FTP Upload task only can exclude the folders. Such as if you use the !**\.git\**
as File patterns, it will only remove the .git
folder and the subfolders in it, but the files in these folder still upload to FTP server.
If you don’t want the .git
folder (including the files in it) to be uploaded to FTP, you can add a Copy Files task before FTP Upload task. Detail settings as below:
Copy Files task
Source Folder: $(Build.SourcesDirectory)
Contents:
**
!**\.git\**
Target Folder: $(Build.ArtifactStagingDirectory)\upload
FTP Upload task
You just need to change below settings,
Source folder: $(Build.ArtifactStagingDirectory)\upload
File patterns: **
Now exclude the files in .git
folder, all the files and folders are upload to FTP server.