I want to copy file from Ubuntu 16.04 azuredevops agent to remote linux host (also have azuredevops agent installed).
I copied public key to ~/.ssh/authorized_keys
From terminal, all works fine
scp myagent/_work/10/s/docker-compose.yml root@192.168.1.76:/opt
docker-compose.yml 100% 1036 1.0KB/s 00:00
I created step in pipeline to execute exactly same command
But now getting error
2020-07-08T08:54:43.5359334Z [command]/bin/bash --noprofile --norc /home/user/myagent/_work/_temp/3ce8bc1e-7842-4f97-bc35-884893882d3c.sh
2020-07-08T08:54:43.5442624Z Pseudo-terminal will not be allocated because stdin is not a terminal.
2020-07-08T08:54:43.6019929Z Host key verification failed.
2020-07-08T08:54:43.6074975Z
2020-07-08T08:54:43.6245687Z ##[error]Bash exited with code '255'
You can use Copy Files Over SSH task to copy files to remote server.
First you need to create a SSH service connection to connect with with the remote server.
Go to project settings--> Pipelines-->Service connections-->new service connection-->Select SSH.
Then add Copy Files Over SSH task in your pipeline to copy the files to the remote server.
If you want to run script in remote server, you can use SSH task.