On premise TFS Git OAuth clone failed on agent

利用TFS2015的跨平台生成代理,在mac osx 上生成xamarin.ios项目,agent费劲九牛二虎之力搞定了(参见http://www.cnblogs.com/zjoch/p/5811017.html),发起生成任务却死活无法获取源码版本,

错误如下:

2016-09-02T08:13:24.186Z: preparing Workspace
 
2016-09-02T08:13:24.187Z: cwd: /Users/owner/myagent/_work
 
2016-09-02T08:13:24.188Z: Repository type: TfsGit
 
2016-09-02T08:13:24.188Z: using source provider: tfsgit
 
2016-09-02T08:13:24.188Z: loading: /Users/owner/myagent/agent/scm/tfsgit
 
2016-09-02T08:13:24.194Z: Using auth scheme: OAuth
 
2016-09-02T08:13:24.199Z: running incremental
 
2016-09-02T08:13:24.199Z: getting code
 
2016-09-02T08:13:24.200Z: http://tfs2013-tfs:8080/tfs/DefaultCollection/_git/GitMobileApps
 
2016-09-02T08:13:24.200Z: srcVersion: 4d93b485cfef047e3418760345bc953139a0230e
 
2016-09-02T08:13:24.200Z: srcBranch: refs/heads/master
 
2016-09-02T08:13:24.200Z: Using ref: 4d93b485cfef047e3418760345bc953139a0230e
 
2016-09-02T08:13:24.208Z: Cloning into 's'...
 
2016-09-02T08:13:24.209Z: 
 
2016-09-02T08:13:24.242Z: fatal: Authentication failed for 'http://OAuth:********@tfs2013-tfs:8080/tfs/DefaultCollection/_git/GitMobileApps/'
 
2016-09-02T08:13:24.242Z: 
 
##[Error] 2016-09-02T08:13:24.247Z: /usr/bin/git failed with return code: 128

经过bing搜索,找到了下面的老外的解决办法:

try setting envvar(解决办法,在tfs的生成定义中,添加这2个变量,并填写正确的账号密码,如:esp fscompile域账号)

VSO_GIT_USERNAME
VSO_GIT_PASSWORD

https://github.com/Microsoft/vso-agent/blob/master/src/agent/scm/tfsgit.ts

原文:https://github.com/Microsoft/vso-agent/issues/68 感谢他们!

原文地址:https://www.cnblogs.com/zjoch/p/5833987.html