我正在使用Bamboo OnDemand,我正在尝试设置SSH任务来复制文件。 (注意:SCP独立任务目前不是一个选项)。
无论我尝试什么,因为ssh命令会导致错误..
invalid characters in scp command!
我研究过该消息,它通常与保留字符的文件或目录名相关,例如空间,但我没有任何这些。仅使用简单文件(index.php)进行测试就会失败。
我尝试的命令是:
scp index.php user@mydomain.co.uk:/httpdocs/test
scp index.php 'user@mydomain.co.uk:/httpdocs/test'
scp index.php "user@mydomain.co.uk:/httpdocs/test"
scp "index.php" "user@mydomain.co.uk:/httpdocs/test"
"scp index.php user@mydomain.co.uk:/httpdocs/test"
scp index.php user@mydomain.co.uk://httpdocs//test
scp index.php user@mydomain.co.uk:\/httpdocs\/test
scp index.php user@mydomain.co.uk:"//httpdocs//test"
都会导致同样的错误...
simple 29-Oct-2014 09:06:11 Starting task 'SSH Test' of type 'com.atlassian.bamboo.plugins.bamboo-scp-plugin:sshtask'
simple 29-Oct-2014 09:06:12 Connecting to mydomain.co.uk on port: 22
simple 29-Oct-2014 09:06:13 Executing [scp index.php user@mydomain.co.uk:/httpdocs/test]
error 29-Oct-2014 09:06:13 invalid characters in scp command!
error 29-Oct-2014 09:06:13 here:@mydomain.co.uk:/httpdocs/test
error 29-Oct-2014 09:06:13 try using a wildcard to match this file/directory
simple 29-Oct-2014 09:06:13 [scp index.php user@mydomain.co.uk:/httpdocs/test] has finished.
error 29-Oct-2014 09:06:13 Result: exit code = 1
任何人都可以通过ssh任务共享scp命令的有效示例吗?或者这实际上是不可能的,你被迫使用SCP专用任务?谢谢!
答案 0 :(得分:1)
" scp命令中的无效字符!...尝试使用通配符匹配此文件/目录"是scponly
程序发出的错误。 Scponly用作仅允许在主机内外进行scp传输的用户的shell。错误的直接原因是您正在尝试运行命令" scp index.php user@mydomain.co.uk:/ httpdocs / test"在mydmain.co.uk上,这不是scponly计划允许的。
我认为这里真正的问题是您使用ssh和scp不正确。您正在使用ssh连接到mydomain.co.uk,然后尝试运行命令" scp index.php user@mydomain.co.uk:/ httpdocs / test"在那台主机上。这意味着您在mydomain.co.uk上运行scp,将index.php从mydomain.co.uk复制到mydomain.co.uk。
我认为您真正想要做的是在本地主机上运行scp
,将文件复制到mydomain.co.uk。我不确切知道Bamboo有什么功能,但你不会使用ssh任务。您希望使用在本地主机上运行命令的任务,而不是某些远程主机上的命令。