Install Git On Windows With PowerShell
May 4th, 2010
I like Git and here's a PowerShell script that I use to download and install Git on my Windows based development machines.
POWERSHELL:
-
# Installs git for Windows via PowerShell
-
#
-
# Sample usage:
-
#
-
# Install git:
-
# PS> install-git
-
#
-
# Adam Kahtava - http://adam.kahtava.com/ - MIT Licensed
-
-
function global:install-git {
-
install-file 'http://msysgit.googlecode.com/files/Git-1.6.4-preview20090730.exe'
-
}
-
-
function global:install-file([string] $urlPath) {
-
$filename = download-file($urlPath)
-
invoke-item $filename
-
}
-
-
function global:download-file([string] $urlPath) {
-
$urlSplit = $urlPath.split('/')
-
$filename = (Resolve-Path .).ToString() + '' + $urlSplit[$urlSplit.length - 1]
-
$webclient = New-Object "System.Net.WebClient"
-
$webclient.DownloadFile($urlPath, $filename)
-
return $filename
-
}
Not familiar with Git? Then head over to the best online Git resource available.
You can find more of my PowerShell development scripts here.