我尝试按照these steps在TFS 2015(Update 3)构建步骤中添加一些git命令。
为了测试,我尝试了'git ls-files',这很有用。
然后我尝试'git pull'。
它会显示:
2017-02-09T03:23:36.7164903Z git pull
2017-02-09T03:23:36.7164903Z Error message highlight pattern:
2017-02-09T03:23:36.7164903Z Warning message highlight pattern:
2017-02-09T03:23:36.9660887Z bash: /dev/tty: No such device or address
2017-02-09T03:23:36.9660887Z error: failed to execute prompt script (exit code 1)
2017-02-09T03:23:36.9660887Z fatal: could not read Username for 'http://htwb0228:8080': Invalid argument
然而,Git通过本地操作完全在TFS服务器的'_work'文件夹上运行良好。
我已经尝试了很多解决方案。对我来说,他们没有工作。
我尝试使用Git Build Tools,但仍然失败了。
2017-02-09T01:53:41.3965148Z git pull
2017-02-09T01:53:41.3965148Z Error message highlight pattern:
2017-02-09T01:53:41.3965148Z Warning message highlight pattern:
2017-02-09T01:53:42.4729079Z fatal: Authentication failed for 'http://OAuth:********@htwb0228:8080/tfs/DefaultCollection/KKKKK/_git/PPPP/'
对于这个问题,我提到this page添加两个变量(VSO_GIT_USERNAME& VSO_GIT_PASSWORD)来构建脚本。它仍然无效。
我将Git升级到2.11.1并在TFS服务器上安装了GCMW。
此外,通过引用this page,我还在TFS服务器上输入了这些命令。
git config --global credential.http://htwb0228:8080.integrated true
git config --global credential.http://htwb0228.integrated true
git config --global credential.htwb0228.integrated true
git config --global credential.integrated true
它仍然无效。
还有其他建议吗?非常感谢。
答案 0 :(得分:1)
您无需保存用户名和密码。您需要做的就是启用“允许脚本访问OAuth令牌”,您的构建任务将能够使用内置身份验证回调到TFS / VSTS。
虽然此屏幕截图来自VSTS,但该选项也存在于TFS中并具有相同的名称。
启用后,您可以回拨您的git repo,或者在没有其他身份验证的情况下解析任何其他TFS。
答案 1 :(得分:0)
使用以下命令将起作用:
ob_start();
// Send your response.
echo json_encode(array('status' => 'ok')) ;
// Get the size of the output.
$size = ob_get_length();
// Disable compression (in case content length is compressed).
header("Content-Encoding: none");
header($_SERVER["SERVER_PROTOCOL"] . " 202 Accepted");
header("Status: 202 Accepted");
// Set the content length of the response.
header("Content-Length: {$size}");
// Close the connection.
header("Connection: close");
ignore_user_abort(true);
set_time_limit(0);
// Flush all output.
ob_end_flush();
ob_flush();
flush();
session_write_close();
fastcgi_finish_request();
// Do processing here
sleep(5);
callBackAfterResponse();
查看下面的屏幕截图:
对于密码,您可以添加变量并保密。