-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssh.ps1
66 lines (61 loc) · 2.91 KB
/
ssh.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
$idrsa = $env:OneDrive + "\keys\git\id_rsa"
$idrsapub = $env:OneDrive + "\keys\git\id_rsa.pub"
if ((Test-Path -path $idrsa) -and (Test-Path -path $idrsapub))
{
#Windows SSH Key Must Be id_rsa or will fail with permission denied
echo "Saving SSH Key"
md $HOME/.ssh
cp $idrsa $HOME\.ssh\id_rsa
cp $idrsapub $HOME\.ssh\id_rsa.pub
echo "Add SSH Key"
ssh-add
echo "Add GitHub Connection"
ssh -o StrictHostKeyChecking=no git@github.com
ssh-keyscan -H github.com >> $HOME/.ssh/known_hosts
ssh -T git@github.com
echo "Add GitLab Connection"
ssh -o StrictHostKeyChecking=no git@gitlab.com
ssh-keyscan -H gitlab.com >> $HOME/.ssh/known_hosts
ssh -T git@gitlab.com
echo "Setting Git Bash SSH"
Add-Content $HOME\.bash_profile 'eval $(ssh-agent -s)'
Add-Content $HOME\.bash_profile 'ssh-add'
}
else
{
echo "No SSH Key Found in: "
echo $idrsa
echo $idrsapub
}
# SIG # Begin signature block
# MIIFfwYJKoZIhvcNAQcCoIIFcDCCBWwCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUC69zQVk1Syr0gNthWI/usT0N
# ZQKgggMUMIIDEDCCAfigAwIBAgIQEt8fR2Y16oVNsrl51ayDBTANBgkqhkiG9w0B
# AQUFADAgMR4wHAYDVQQDDBVzYXVsb0BwYXJhbGluay5jb20uYnIwHhcNMjAwMjI0
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