Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git Azure web app部署导致VS团队服务中的PowerShell失败_Git_Powershell_Azure_Web_Azure Devops - Fatal编程技术网

Git Azure web app部署导致VS团队服务中的PowerShell失败

Git Azure web app部署导致VS团队服务中的PowerShell失败,git,powershell,azure,web,azure-devops,Git,Powershell,Azure,Web,Azure Devops,我正在使用VS Team Services提供的CI构建web应用程序并部署到Azure。它基本上使用了此处描述的“本地git回购”方法: 我使用PowerShell脚本运行部署,如下所示: $sourcePath = Get-Location cd .. mkdir deploy cd deploy $deployPath = Get-Location git init git config core.safecrlf false git remote add azure <fill-i

我正在使用VS Team Services提供的CI构建web应用程序并部署到Azure。它基本上使用了此处描述的“本地git回购”方法:

我使用PowerShell脚本运行部署,如下所示:

$sourcePath = Get-Location
cd ..
mkdir deploy
cd deploy
$deployPath = Get-Location
git init
git config core.safecrlf false
git remote add azure <fill-in>
git pull azure master --quiet
git rm -rf .
git clean -fxd
git reset
Copy-Item $sourcePath\* $deployPath -Recurse
git add -A
git commit -m "Deploy"
git push azure master --porcelain
$sourcePath=获取位置
光盘
mkdir部署
cd部署
$deployPath=获取位置
初始化
git config core.safecrlf false
git远程添加azure
git pull azure master--安静
吉特rm-rf。
git-clean-fxd
git重置
复制项$sourcePath\*$deployPath-递归
git添加-A
git提交-m“部署”
git推蓝大师——瓷器
我注意到一些git操作,如push和pull,会导致PowerShell看到错误(即使操作成功)。这就是为什么我使用“安静”和“瓷器”选项

现在棘手的部分是,在推送操作之后,Azure将自动运行一些部署脚本。这会导致PowerShell看到错误,即使操作成功,而且…我无法控制这一点

如何让PowerShell正确识别真实错误


顺便说一句,如果您看到更好或更有效的方法,我很乐意了解它。

尝试使用以下格式调用git命令:

git pull 2>&1 | Write-Host

有关详细信息,请参阅Pascal Berger在此问题中的回答:

您是从VSTS版本还是从发布版运行powershell脚本?我是从VSTS版本运行它。您是否尝试了链接中的解决方案?是的。看起来很有效。谢谢