【发布时间】:2018-03-27 06:33:57
【问题描述】:
我正在编写用于将 GitHub 源代码克隆到本地计算机的自动化脚本。
在我的脚本中安装 Git 后我失败了,它要求关闭/打开 powershell。
所以我安装Git后无法自动克隆代码。
这是我的代码:
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y git
refreshenv
Start-Sleep -Seconds 15
git clone --mirror https://${username}:${password}@$hostname/${username}/$Projectname.git D:\GitTemp -q 2>&1 | %{ "$_" }
错误:
git : The term 'git' is not recognized as the name of a cmdlet,
function, script file, or operable program.
Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
请让我在不退出的情况下重新启动 PowerShell 应该放什么?
【问题讨论】:
标签: powershell installation environment-variables refresh chocolatey