I already read this and this and this answers but non of them helped me.
I am using Windows machine for Jenkins
My workspace has only the following files
C:\Jenkins\workspace\Copy_file\DevOps\resource\file1.txt
C:\Jenkins\workspace\Copy_file\DevOps\resource\file2.txt
I would like to publish over ssh only file1.txt
I added the plugin to Publish Over SSH:
Source files DevOps\resource\file1.txt
Remove prefix DevOps\resource
Remote directory /tmp/
However I see in the result:
C:\Jenkins\workspace\Copy_file\DevOps\resource\file1.txt
SSH: Connecting from host [hhhhh]
SSH: Connecting with configuration [Redhat1] ...
SSH: Creating session: username [hhhh], hostname [iiiiii], port [22]
SSH: Connecting session ...
SSH: Connected
SSH: Opening SFTP channel ...
SSH: SFTP channel open
SSH: Connecting SFTP channel ...
SSH: Connected
SSH: Remote root is not absolute, getting absolute directory from PWD
SSH: Disconnecting configuration [Redhat1] ...
SSH: Transferred 0 file(s)
Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
Finished: SUCCESS
- Why is it sending 0 files?
- How can I make the path absolute so it will put it in /tmp/ and not in /home/user/tmp?
UPDATED
![](https://www.manongdao.com/static/images/pcload.jpg)
I had the same problem and I ended in this post looking for the solution.
Specifically what happened to me, is that the user we use in the plugin configuration did not have access to the "root path" ("/"), which cause the connection to be default located in "/home/usery/".
Make sure the user that you are using have access to the absolute path "/tmp/" because when I tried with the same configuration that you have this user created this path (/home/usery/tmp and not in the /tmp/ path):
SSH: Remote root is not absolute, getting absolute directory from PWD
SSH: cd [/home/usery]
SSH: OK
SSH: mkdir [tmp]
SSH: OK
SSH: cd [tmp]
SSH: OK
SSH: put [myjar.jar]
Maybe you user does not have permissions to create a new directory.
Try to use the "home" path of the user, for example, try to create a path "/home/usery/localdir/anotherDir", then change the configuration of "Remote directory" to "localdir/anotherDir".
Finally, we installed Jenkins on a Windows machine, later we move it to a Linux machine, you have to be careful with the path separator "\" and "/", keep this in mind setting up:
source files
and
remove prefix
I hope my comments help you.
I have been researching about this plugin, but I can´t find the reason why doesn´t work.
The Q.A. team in my company uses this plugin and it works ok.
By try to answering your question I will try to explain the configuration about this new plugin:
Hope it helps!
After looking at the plugin source code, it appears that it defaults to using a relative path if no "Remote Directory" is set in your ssh server configuration.
Go to Manage Jenkins/Confgiure System and under the plugin settings for publish over ssh, set Remote Directory to "/"