Skip to content

Commit 02eb4d5

Browse files
authored
Merge pull request #943 from agowa338/patch-1
Mention PowerShell Repository
2 parents 3acfc28 + 2334766 commit 02eb4d5

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

book/A-git-in-other-environments/sections/powershell.asc

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,43 @@ It looks like this:
1010
.Powershell with Posh-git.
1111
image::images/posh-git.png[Powershell with Posh-git.]
1212

13-
Just download a Posh-Git release from (https://github.com/dahlbyk/posh-git[]), and uncompress it to the `WindowsPowershell` directory.
14-
Then open a Powershell prompt as the administrator, and do this:
13+
==== Installation
14+
===== Prerequisites
15+
Before you're able to run PowerShell scripts on your machine, you need to set your local ExecutionPolicy to RemoteSigned (Basically anything except Undefined and Restricted). If you choose AllSigned instead of RemoteSigned, also local scripts (your own) need to be digitally signed in order to be executed. With RemoteSigned, only Scripts having the "ZoneIdentifier" set to Internet (were downloaded from the web) need to be signed, others not.
16+
If you're an administrator and want to set it for all Users on that machine, use "-Scope LocalMachine".
17+
If you're a normal user, without administrative rights, you can use "-Scope CurrentUser" to set it only for you.
18+
More about PowerShell Scopes: (https://technet.microsoft.com/de-de/library/hh847849.aspx[])
19+
More about PowerShell ExecutionPolicy: (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy[])
20+
21+
[source,powershell]
22+
-----
23+
> Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force
24+
-----
25+
26+
===== PowerShell Gallery
27+
If you have at least PowerShell 5 or PowerShell 4 with PackageManagement installed, you can use the package manager to fetch Posh-Git for you.
28+
More information about the requirements: (https://docs.microsoft.com/en-us/powershell/gallery/psget/get_psget_module[])
29+
[source,powershell]
30+
-----
31+
> Update-Module PowerShellGet -Force
32+
> Install-Module Posh-Git -Scope LocalMachine
33+
-----
34+
If you want to install Posh-Git only for the currnet user and not globaly, use "-Scope CurrentUser" instead.
1535

36+
===== Update PowerShell Prompt
37+
To include git information in your prompt, posh-git needs to be imported. To do this automatically, include the import statement into you $profile script. This script is executed everytime you open a new PowerShell prompt.
38+
Keep in mind, that there are multiple $profile scripts. E. g. one for the console and a separate one for the ISE.
39+
[source,powershell]
40+
-----
41+
> 'Import-Module Posh-Git' | Out-File -Append -Encoding default -FilePath $profile
42+
-----
43+
44+
===== From Source
45+
Just download a Posh-Git release from (https://github.com/dahlbyk/posh-git[]), and uncompress it to the `WindowsPowershell` directory.
46+
Then open a Powershell prompt as an administrator, and do this:
1647
[source,powershell]
1748
-----
18-
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm
19-
> cd ~\Documents\WindowsPowerShell\posh-git
49+
> cd ~\Documents\WindowsPowerShell\Module\posh-git
2050
> .\install.ps1
2151
-----
2252

0 commit comments

Comments
 (0)