2017-10-13 65 views
1

我必須編寫自動化的powershell腳本來從gihtub克隆存儲庫,但我需要使用命令行安裝git。請您告訴我如何下載並安裝git on窗口使用命令行而不做任何手動工作。如何使用Powershell下載和安裝git客戶端窗口

在此先感謝!

+0

你不會..在窗口,你可以做到這一點從EXE安裝不是通過命令行.. –

+0

請參閱HTTPS ://thepracticalsysadmin.com/setting-up-git-in-windows/ – ElpieKay

回答

1

您可以使用chocolatey腳本安裝Git。

包在https://chocolatey.org/packages/git

  1. 首先你必須install chocolatey, but that can be done on the command line被記錄在案。
  2. 則命令爲:

巧克力安裝-y混帳

+0

非常感謝你:)這真的很有幫助。 –

+0

我已經成功地安裝了git,但是一旦我嘗試檢查git --version並且我是例外**「git:術語'git'不被識別爲cmdlet,函數,腳本文件或可操作程序的名稱。 的拼寫名稱,或者如果包含路徑,請驗證路徑是否正確,然後再試。 在行:1 char:1 + git --version + ~~~ + CategoryInfo:ObjectNotFound :(git:String)[],CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException 「** –

+0

@PriyaRani聽起來像git畢竟不在PATH上。看起來安裝命令是否成功? –