Skip to content

Commit 2abc389

Browse files
committed
Update options when installing Git, update script, and update ExecutionPolicy
1 parent ecaa448 commit 2abc389

2 files changed

Lines changed: 32 additions & 32 deletions

File tree

GitSetup.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ function DownloadGit
8989
{
9090
$text = @"
9191
`$env:path += ";" + (Get-Item "Env:ProgramFiles").Value + "\Git\bin"
92-
`$env:path += ";" + (Get-Item "Env:ProgramFiles").Value + "\Git\cmd"
9392
`$env:home = `$env:userprofile
9493
9594
#Alias
@@ -107,7 +106,6 @@ Start-Service ssh-agent
107106
{
108107
$text = @"
109108
`$env:path += ";" + (Get-Item "Env:ProgramFiles").Value + "\Git\bin"
110-
`$env:path += ";" + (Get-Item "Env:ProgramFiles").Value + "\Git\cmd"
111109
`$env:path += ";" + (Get-Item "Env:ProgramFiles").Value + "\Git\usr\bin"
112110
`$env:home = `$env:userprofile
113111

README.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
11
# GitSetup
2-
This repository will setup Git for shell warriors.
2+
3+
This repository will setup Git for shell warriors.
34
It includes setup of Posh-git, P4Merge, and several shortcuts.
45

6+
## Step 1 - Installing Git
57

6-
## Step 1 - Installing Git:
78
* Download Git from the following link:
8-
https://git-for-windows.github.io/
9+
<https://git-for-windows.github.io/>
910
* Install it with the following parameters:
10-
* Check the following under 'Selected Components', and uncheck everything else unless needed
11-
* Git LFS
12-
* Use a TrueType font in all console windows
13-
* Select your preferred option of the three editors
14-
* **It will be overridden when this tutorial is done**
15-
* Select the following radio button under 'Adjusting your PATH environment'
16-
* Use Git from the Windows Command Prompt
17-
* Select the following radio button under 'HTTPS transport backend'
18-
* Use the OpenSSL library
19-
* Select the following radio button under 'Configuring the line ending conversions'
20-
* Checkout as-is, commit as-is
21-
* Select the following radio button under 'Configuring the terminal emulator to use with Git Bash'
22-
* Use Windows' default console window
23-
* The check boxes under 'Configuring extra options' are optional
24-
25-
26-
## Step 2 - Running the script:
11+
* Check the following under 'Selected Components', and uncheck everything else unless needed
12+
* Git LFS
13+
* Associate .git* configuration files with the default text editor
14+
* Check daily for Git for Windows updates
15+
* Add a Git Bash Profile to Windows Terminal
16+
* Select your preferred option of the three editors
17+
* **It will be overridden when this tutorial is done**
18+
* **Adjusting your PATH environment**:
19+
* Git from the command line and also from 3rd-party software
20+
* **Choosing the SSH executable**:
21+
* Use bundled OpenSSH
22+
* **HTTPS transport backend**:
23+
* Use the OpenSSL library
24+
* **Configuring the line ending conversions**:
25+
* Checkout as-is, commit as-is
26+
* **Configuring the terminal emulator to use with Git Bash**:
27+
* Use Windows' default console window
28+
* **Choose the default behavior of `git pull`**
29+
* Fast-forward or merge
30+
* **Choose a credential helper**
31+
* Git Credential Manager
32+
* The check boxes under 'Configuring extra options' are optional
33+
34+
## Step 2 - Running the script
2735

2836
* Open PowerShell in **Administrator mode**:
2937

@@ -36,15 +44,15 @@ $Folderpath = ".\GitSetup" #Current location in a folder called "GitSetup"
3644
3745
# Download data from he Git repository
3846
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
39-
Invoke-WebRequest -URI https://github.com/bakgaard/GitSetup/archive/master.zip -OutFile "$Folderpath.zip"
47+
Invoke-RestMethod -Uri https://github.com/bakgaard/GitSetup/archive/master.zip -OutFile "$Folderpath.zip"
4048
4149
# Unzip the files
4250
Expand-Archive "$Folderpath.zip" -DestinationPath $Folderpath -Force
4351
4452
cd "$Folderpath/GitSetup-master"
4553
4654
# Setup PowerShell for Git
47-
Set-ExecutionPolicy RemoteSigned -Scope Process -Confirm -Force
55+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm -Force
4856
./GitSetup $YourName $YourEmail
4957
5058
# Clean up .zip-file and extracted folder
@@ -53,7 +61,6 @@ rm "$Folderpath.zip"
5361
rmdir $Folderpath -Recurse -Force
5462
```
5563

56-
5764
### Step 3 - Fix mergetool error
5865

5966
You will most likely encounter a merge tool error, which might be because you are missing ``msvcr110.dll``.
@@ -63,14 +70,10 @@ Download and install the [Visual C++ Redistributable for Visual Studio 2013](htt
6370
choco install vcredist2013 -y
6471
```
6572

66-
67-
68-
6973
## Errors
7074

7175
This is not perfect, so you might encounter an error or two:
7276

73-
7477
### Can't run .ps1-script
7578

7679
This happens, and I can't really find the root cause, but I have a work-around:
@@ -79,7 +82,6 @@ This happens, and I can't really find the root cause, but I have a work-around:
7982
* Copy everything to a new document, and save it as ``setup.ps1``
8083
* Run ``setup.ps1 "Your name" "Your email"``
8184

82-
8385
## Git cheat sheet
8486

8587
| **Simple operations** | **Full command** | **Alias version** |
@@ -91,7 +93,7 @@ This happens, and I can't really find the root cause, but I have a work-around:
9193
| Fetch (peak) the latest changes | ``git fetch`` | ``g ft`` |
9294
| Pull the latest changes | ``git pull`` | ``g pl`` |
9395
| Show the status as a one-liner | ``git status -s`` | ``g ss`` |
94-
| | |
96+
| | | |
9597
| **Branches and merges** | **Full command** | **Alias version** |
9698
| Create branch | ``git branch BranchName`` | ``g br BranchName`` |
9799
| Checkout / switch branch | ``git checkout ExistingBranchName`` | ``g co ExistingBranchName`` |
@@ -101,7 +103,7 @@ This happens, and I can't really find the root cause, but I have a work-around:
101103
| See branch tree | ``git log --graph --pretty=format...`` | ``g lg`` |
102104
| See remote branches | ``git branch -r`` | ``g br -r`` |
103105
| Clean up deleted branches | ``git fetch -p`` | ``g ft -p`` |
104-
| | |
106+
| | | |
105107
| **Undo operations** | **Full command** | **Alias version** |
106108
| Remove all pending changes | ``git checkout .`` | ``g co .`` |
107109
| Rollback everything to last commit | ``git reset --hard HEAD^`` | |

0 commit comments

Comments
 (0)