我试图在PowerShell脚本中运行Git pull请求。当我运行下面列出的代码时,我得到了:
From http://10.12.10.107:7990/scm/ta/installer
At :line:1 char:2
+ & <<<< git pull http://myuser:mypassword@10.10.10.10:7990/scm/tainstaller.git > C:\temp\git_out.txt
脚本是:
$TestDbScriptLoc = "C:\git\installer\src\dev\resources"
$GitOutput = "C:\temp\git_out.txt"
$PullCommandLine = "git pull http://myuser:mypassword@10.12.10.107:7990/scm/ta/installer.git"
cd $TestDbScriptLoc
$Result = Invoke-Expression -Command "& $PullCommandLine > $GitOutput" 2> $null
Write-Host (get-Content $GitOutput)
奇怪的是,当我在Windows 7上运行相同的PowerShell代码时,它可以工作。它不适用于Windows Server 2012。