我正在尝试使用Nant.Contrib中的scp任务将文件复制到远程服务器。
我使用了以下代码来完成此操作:
<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>但是我得到了一个错误: scp启动失败。系统找不到指定的文件。代码如下:然后我下载了pscp.exe并修改了代码,如下所示:
<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>现在我得到以下错误:
scp ssh_init:host不存在
外部程序Failed:C:\pscp\pscp.exe
您能帮助一下使用Nant复制文件到远程服务器的最好方法是什么吗?我正在使用这段代码将文件部署到远程服务器。
谢谢
发布于 2009-12-10 18:08:02
你不需要在你的服务器IP后面放两个反斜杠。
<scp file="D:\SourceTest\redist.txt" server="10.4.30.19" user="xxx:uuuu" program="C:\pscp\pscp.exe"> 还要注意,如果没有"path“参数,默认的目标文件夹是"~”。
更新:它是导致pscp.exe程序崩溃的用户名。删除用户名中的":“或尝试使用其他用户名。
发布于 2010-04-27 07:21:29
在windows中,pscp解析路径的方式似乎有些奇怪。下面应该解决ssh_init:host不存在的问题:
-upload
pscp some.file user@[remote-host-or-ip]:/some/path/
-download
pscp user@[remote-host-or-ip]:/some/path/some.file some.filehttps://stackoverflow.com/questions/1879974
复制相似问题