Created
November 25, 2013 04:47
-
-
Save originalmind/7636510 to your computer and use it in GitHub Desktop.
Set the PortableGit (supplied by GitHub for Windows) path for use in PowerShell console.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: Call this script from your PowerShell profile: | |
# & c:\path\to\scripts\set-path-portablegit.ps1 | |
# todo: set GITHUB_ROOT from registry | |
Set-Variable -Option Constant -Name GITHUB_ROOT -Value ${Env:USERPROFILE}\AppData\Local\GitHub\ | |
# Get the most recently created version of PortableGit | |
if (!(Test-Path $GITHUB_ROOT)) { | |
Write-Host Sorry can''t find GitHub path. | |
exit 1 | |
} | |
$PortableGitDir = gci $GITHUB_ROOT | where-object { $_.Name -like 'PortableGit*' } | sort CreationTime | select -last 1 | |
if (!(Test-Path $PortableGitDir.FullName)) { | |
Write-Host Sorry can''t find Portable Git path. | |
exit 2 | |
} | |
$PortableGitDirName = $PortableGitDir.FullName | |
Write-Host Adding Portable Git location to path: $PortableGitDirName | |
$env:Path += ";$PortableGitDirName\bin;$PortableGitDirName\cmd" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment