简体   繁体   English

Windows Machine中的TFS SSH任务失败

[英]TFS SSH task in Windows Machine failed

I tried to connect a Windows machine that exist in another domain than our TFS 2018.3 exist. 我试图连接存在于除我们的TFS 2018.3之外的其他域中的Windows计算机。

I added "SSH" task, and I created new SSH endpoint with the remote machine IP, username and password, without a private key. 我添加了“ SSH”任务,并使用远程计算机IP,用户名和密码创建了新的SSH端点, 而没有私钥。 I configured in the remote machine access of SSH for this username & password. 我在SSH的远程计算机访问中配置了此用户名和密码。

In the SSH task, I configure a simple shell command: ls . 在SSH任务中,我配置了一个简单的shell命令: ls

The TFS agent succeeded to connect the machine but failed with this error: TFS代理成功连接了机器,但失败并出现以下错误:

Unable to execute command or shell on remote system: Failed to Execute process. 无法在远程系统上执行命令或外壳程序:无法执行进程。

Full log: 完整日志:

2019-08-15T13:22:54.1491966Z Trying to setup SSH connection to ********@myserverinanotherdomain:22

2019-08-15T13:22:54.4085564Z Successfully connected.

2019-08-15T13:22:54.8120684Z tr -d '\015' <"./sshscript_1565875374136" > "./sshscript_1565875374136._unix"

2019-08-15T13:22:54.8121422Z Unable to execute command or shell on remote system: Failed to Execute process.

2019-08-15T13:22:54.8121745Z

2019-08-15T13:22:54.8180230Z ##[error]Command tr -d '\015' <"./sshscript_1565875374136" > "./sshscript_1565875374136._unix" exited with code 4294967295.

I think because it's a Windows machine and I try to execute a shell script. 我想是因为它是Windows计算机,所以我尝试执行Shell脚本。 If I will install Git bash, for example, it can help? 例如,如果我要安装Git bash,它可以提供帮助吗?

Does the SSh task support only Linux machines? SSh任务仅支持Linux计算机吗? if yes, how can I connect a machine that exists in another domain? 如果是,如何连接另一个域中存在的计算机?

SSH being a communication protocol is agnostic of OS. SSH是一种通信协议,与OS无关。 It is not Linux specific. 它不是特定于Linux的。 But there seems to be a limitation for using SSH task on windows machine/build agent. 但是在Windows计算机/构建代理上使用SSH任务似乎存在局限性。 Take a look at this similar question here: Not able to run bash script from windows using vsts. 在这里看看这个类似的问题: 无法使用vsts从Windows运行bash脚本。

I haven't found a documentation that clearly declare the SSh task not support on Windows machine. 我还没有找到明确声明Windows机器不支持SSh任务的文档。 But I have found a task which also uses SSH--Copy Files Over SSH task. 但是我发现了一个也使用SSH的任务-通过SSH复制文件任务。 And according to the Q&A in official link : 并根据官方链接中的问答:

Is this task supported for target machines running operating systems other than Linux? 运行非Linux操作系统的目标计算机是否支持此任务?

This task is intended for target machines running Linux . 此任务适用于运行Linux的目标计算机

  • For copying files to a macOS machine, this task may be used, but authenticating with a password is not supported. 要将文件复制到macOS计算机,可以使用此任务,但不支持使用密码进行身份验证。
  • For copying files to a Windows machine, consider using Windows Machine File Copy. 要将文件复制到Windows计算机,请考虑使用Windows Machine File Copy。

Instead of SSH. 代替SSH。 You should be able to use a local account on the build server and when entering the credentials. 输入凭据时,您应该能够在构建服务器上使用本地帐户。 The account must have the same password as the account in the other domain. 该帐户必须与另一个域中的帐户具有相同的密码。 In other works make sure build account which run on the build agent are able to connect another domain. 在其他工作中,请确保在构建代理上运行的构建帐户能够连接另一个域。

Also make sure there is a trust relationship between the domains. 还要确保域之间存在信任关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM