Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bootstrap-git
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
powershell
bootstrap-git
Commits
8a25cfa0
Commit
8a25cfa0
authored
6 years ago
by
Dennis Ahrens
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit
parent
d73a3960
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Install.ps1
+66
-0
66 additions, 0 deletions
Install.ps1
README.md
+7
-1
7 additions, 1 deletion
README.md
with
73 additions
and
1 deletion
Install.ps1
0 → 100644
+
66
−
0
View file @
8a25cfa0
$targetDirectory
=
"C:\hshgitlab"
$gitDir
=
"
${env:programfiles}
\Git\"
$sshKeygenExe
=
"
$gitDir
\usr\bin\ssh-keygen.exe"
$sshKeyName
=
"
$targetDirectory
\id_rsa"
$sshPublicKey
=
"
$sshKeyName
.pub"
<#
Check whether a program is installed.
Note that is searches in the string which you can find in Control Panel -> Programs and Features.
e.g. it will not find "python3" but "python 3"
#>
function
Is-Installed
(
$program
)
{
$x86
=
((
Get-ChildItem
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
)
|
Where-Object
{
$_
.
GetValue
(
"DisplayName"
)
-like
"*
$program
*"
}
)
.
Length
-gt
0
;
$x64
=
((
Get-ChildItem
"HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
)
|
Where-Object
{
$_
.
GetValue
(
"DisplayName"
)
-like
"*
$program
*"
}
)
.
Length
-gt
0
;
return
$x86
-or
$x64
;
}
"Install just-install for painless installs..."
if
(
Is-Installed
(
"just-install"
))
{
"just-install is already installed"
}
else
{
Start-Process
-NoNewWindow
msiexec.exe
-Wait
-ArgumentList
'-I https://stable.just-install.it -quiet'
}
"Install git"
if
(
Is-Installed
(
"git"
))
{
"git is already installed"
}
else
{
Start-Process
-NoNewWindow
just-install
-Wait
-ArgumentList
'python3'
}
"Make some sanity checks in the environment - verify python and git are located where we think they are..."
if
(
!
(
Test-Path
$pythonExe
)
)
{
"python.exe is not located at:
$pythonExe
"
"either the installation was not successful or the path changed."
}
if
(
!
(
Test-Path
$gitDir
)
)
{
"git installation not found at:
$gitDir
"
"either the installation was not successful or the path changed."
}
"Sanity successfully verified: begin to install our worker"
"Create a directory for our files at
$targetDirectory
"
if
(
!
(
Test-Path
-Path
$targetDirectory
)){
New-Item
-ItemType
directory
-Path
$targetDirectory
|
Out-Null
}
"Generate an SSH Keypair for our server to be able to receive code from git"
"It is located at
$sshKeyName
(.pub)"
if
(
!
(
Test-Path
$sshKeyName
)
)
{
Start-Process
-NoNewWindow
$sshKeygenExe
-Wait
-ArgumentList
"-q -b 4096 -f
$sshKeyName
-N ''"
}
else
{
"There was already a key located at
$sshKeyName
, proceed with this one"
}
if
(
!
(
Test-Path
$sshKeyName
)
)
{
"Key generation not successful"
exit
}
"You now need to tell gitlab about this ssh public key and can proceed with what you want to install"
""
cat
$sshPublicKey
""
This diff is collapsed.
Click to expand it.
README.md
+
7
−
1
View file @
8a25cfa0
...
...
@@ -2,3 +2,9 @@
Use this repository to bootstrap git on your windows box.
It also automatically creates a key pair that can be used to connect to a git server.
Be careful, this executes code directly on your machine. You are expected to read the script before you execute it.
```
powershell
Set-ExecutionPolicy
Bypass
-Scope
Process
-Force
;
iex
((
New-Object
System.Net.WebClient
)
.
DownloadString
(
'https://lab.it.hs-hannover.de/powershell/bootstrap-git/raw/master/Install.ps1'
))
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment