You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/A-git-in-other-environments/sections/powershell.asc
+34-4Lines changed: 34 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,43 @@ It looks like this:
10
10
.Powershell with Posh-git.
11
11
image::images/posh-git.png[Powershell with Posh-git.]
12
12
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[])
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.
15
35
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.
0 commit comments