Reputation: 55
i have a jenkinsfile in deploy stage i need to run rsync command to transfer files to my remote server but always i have this message "connexion unexpectedly closed" as you see in the screenshot , i added the jenkins public key in authorized_keys in my remote server so i can normally connect using ssh from jenkins machine to remote server , but the rsync problem persist
stage ('Deploy') {
echo 'sucess rsync'
def cmd = "ls & rsync -avzu -e ssh . $server:$buildEnvironment"
sh "$cmd"
echo "you're here now"
}
Upvotes: 0
Views: 1943
Reputation: 115
As per the error which you have shared is showing that your fingerprint authentication ssh key is not got accepted.
I believe you are trying to connect the server for the very first time what you can do just add the below line in your config and your problem will get resolve
rsync -avzu -e ' ssh -p 22 -o StrictHostKeyChecking=no'
Upvotes: 2