我有一个TeamCity构建配置,使用带有代理端签出的Team Foundation Server(TFS)VCS根。它正在成功连接到TFS并获取存储库。TFS帐户启用了备用凭据,并且VCS根成功使用了这些凭据。
在构建配置中,我有一个使用tf.exe
发出TFS命令的Powershell runner步骤。
第一个命令:
& "$tfExe" workspaces
执行成功返回工作区信息($tfExe设置为tf.exe路径)。
使用获取存储库的历史记录
& "$tfExe" history . /noprompt /recursive /stopafter:1 /format:detailed
返回消息:
TF30063: You are not authorized to access https://{projectName}.visualstudio.com/DefaultCollection.
我尝试过使用和不使用/login
参数的历史命令,如下所示:
& "$tfExe" history . /noprompt /recursive /stopafter:1 /format:detailed /login:"$usernameAndPassword"
我尝试将$usernameAndPassword
设置为"###Live###\AltUserName,Password"one_answers"AltUserName,Password",但两者都返回了相同的错误。
为什么tf.exe适用于workspaces命令而不适用于history命令?我用凭据调用history命令的方式有什么问题(请记住,这些凭据与TeamCity中VCS根使用的凭据相同)?
首先,直接在CMD中仔细检查此命令是否可以成功工作,而不会出现任何授权错误。
对于/login:
选项,请尝试使用/login:username,[password]