我正在编写一个 powershell 脚本,需要同时将代码推送到多个 git 存储库?
这是我迄今为止的脚本:
param(
[parameter(Mandatory=$true)]
[string]$repoPath,
[parameter(Mandatory=$true)]
[array]$remoteRepos
)
pushd $repoPath
$remoteRepos | % {
#Want to exexcute this without blocking
& git push $_ master --fore -v
}
popd
这是我执行脚本的方式:
gitdeploy.ps1 -repoPath c:\code\myrepo -remoteRepos repo1,repo2
我如何执行& git push $_ master --fore -v
以非阻塞的方式?
SOLUTION
感谢@Jamey 提供的解决方案。我执行这个命令:
Start-Process "cmd.exe" "/c git push $_ master --force -v"
您还可以使用 start-process 在附加命令窗口中运行每个推送。
start-process -FilePath "git" -ArgumentList ("push", $_, "master", "--fore", "-v")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)