我正在编写自动脚本,用于将GitHub源代码克隆到本地机器.
我在我的脚本中安装Git后失败了,它要求close/open 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 | %{ "$_" }
Run Code Online (Sandbox Code Playgroud)
错误:
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.
Run Code Online (Sandbox Code Playgroud)
请告诉我应该在不退出的情况下重新启动PowerShell?
powershell installation refresh environment-variables chocolatey
我想将 TFS 存储库导入 git 并克隆到我的本地机器,我正在使用 git-tf。在我的代码下面:- git-tf clone http://server:8080/tfs/DefaultCollection $/SampleProject D:\TFSRepoName 我想在 url 中传递用户名和密码,所以它自动克隆 repo 而不要求用户名和密码。
我必须编写自动的powershell脚本来从gihtub克隆存储库,但是我需要使用命令行安装git。请让我知道如何在不使用任何手动工作的情况下使用命令行在窗口上下载和安装git。
提前致谢 !
我想使用 aws cloudformation 模板启动多个 Ec2 实例,而不使用 AutoScaling。请让我知道如何启动?