0
votes

I am trying to copy a file to a remote server using scp task in Nant.Contrib .

I have used the following code to do that:

<target name= "QADeploy"description="gthtyb" >
<loadtasks assembly="C:\nantcontrib-0.85\bin\NAnt.Contrib.Tasks.dll" />
<echo message="htyh"/>
<scp file="D:\SourceTest\redist.txt" server="\\10.4.30.19" user="xxx:uuuu">      
</scp>
</target>

But I am getting an error: scp failed to start. The system cannot find the file specified. The code is as follows: Then I have downloaded pscp.exe and modified the code as below:

<target name= "QADeploy"
    description="gthtyb" >
 <loadtasks assembly="C:\nantcontrib-0.85\bin\NAnt.Contrib.Tasks.dll" />

<echo message="htyh"/>

<scp file="D:\SourceTest\redist.txt" server="\\10.4.30.19" user="xxx:uuuu" program="C:\pscp\pscp.exe">      
</scp>

Now I am getting the following error:

[scp] ssh_init:host does not exist

External Program Failed:C:\pscp\pscp.exe

can u please help whats the best way to copy a file to a remote server using Nant. I am using this code to deploy files to a remote server.

Thanks

2
Does it work locally? on a server? anywhere? is the server accessable vis SCP from the command line?Preet Sangha
how can I check if a server is accessible via scp?Mini

2 Answers

1
votes

You don't have to put two backslashes behind the IP of your server.

<scp file="D:\SourceTest\redist.txt" server="10.4.30.19" user="xxx:uuuu" program="C:\pscp\pscp.exe">      

Also note that without the "path" parameter, the default destination folder is "~".

Update: it is the username that is crashing the pscp.exe program. Remove the ":" from your username or try with a different one.

0
votes

it seems like there is some weirdness on how pscp parses paths in windows. The following should fix ssh_init:host does not exist problem:

-upload
pscp some.file user@[remote-host-or-ip]:/some/path/

-download
pscp user@[remote-host-or-ip]:/some/path/some.file  some.file