Scope
Prerequsite
Powershell version 2 or above. Version 5 can be downloaded here.
Script execution policy must be set to either RemoteSigned or Unrestricted.
$PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 0 10586 117
Script execution policy must be set to either RemoteSigned or Unrestricted.
$ Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm
Troubleshooting
$ Get-PSRepository WARNING: Unable to find module repositories.
These errors are indicating that there are no repository available. I have installed posh-git many times and this doesn't look normal to me, since I am also having some proxy issue with my new machine, I am suspecting it could be a firewall / network issue.
I tried some of this, but not much luck.
WARNINGS: Do not use npm install -g posh-git. It is a replica of the original posh-git but not the same package as the genuine one. Look at the package note, it stated that "This is a new project, it's currently working only on Linux..." and the author is not dahlbyk.
$ Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Verbose -Force VERBOSE: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «» VERBOSE: Cannot download link 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409', retrying for '2' more times VERBOSE: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «» VERBOSE: Cannot download link 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409', retrying for '1' more times VERBOSE: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «» VERBOSE: Cannot download link 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409', retrying for '0' more times WARNING: Unable to download the list of available providers. Check your internet connection.
$ choco install poshgit # I cannot even get chocolatey to install because of the same proxy issue... so not an option
$ (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex install-module posh-git Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
Solution
Finally, I went back to the basics, I bypassed the firewall but a direct git clone to the source code and solved the issue.
$ git clone https://github.com/dahlbyk/posh-git.git $ .\posh-git\install.ps1
Extra
I found the default color was a little too dark against the dark background color, so I made some changes in ~/.git/config to make it easier to read.
[color] ui = true [color "status"] changed = magenta bold untracked = yellow bold
Better contrast after changing the color |