when I copy whole directory from one server to another server I use this below script
stage('deploy to another server'){
steps{
sshagent(['SSHAgent']) {
sh 'scp -r StrictHostKeyChecking=no /var/lib/jenkins/workspace/node_js/* [email protected]:/home/ec2-user'
}
}
}
but it showing this error
+ scp -o StrictHostKeyChecking=no /var/lib/jenkins/workspace/node_js/node_modules /var/lib/jenkins/workspace/node_js/package-lock.json /var/lib/jenkins/workspace/node_js/package.json /var/lib/jenkins/workspace/node_js/server.js [email protected]:/home/ec2-user
/var/lib/jenkins/workspace/node_js/node_modules is not a regular file
failed to upload file /var/lib/jenkins/workspace/node_js/node_modules to /home/ec2-user/n`ode_modules
node_modules
is a directory which is into the node_js directory
What is be the right syntax to copy whole directory from one to another server?
New contributor
Jit Paul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.