Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SSHCreateKey
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
AppleApps
rsyncOSX
SSHCreateKey
Commits
6a61bf0b
Commit
6a61bf0b
authored
2 months ago
by
Thomas Evensen
Browse files
Options
Downloads
Patches
Plain Diff
Update SSHCreateKey.swift
parent
03fbae8c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/SSHCreateKey/SSHCreateKey.swift
+7
-7
7 additions, 7 deletions
Sources/SSHCreateKey/SSHCreateKey.swift
with
7 additions
and
7 deletions
Sources/SSHCreateKey/SSHCreateKey.swift
+
7
−
7
View file @
6a61bf0b
...
...
@@ -39,23 +39,23 @@ public final class SSHCreateKey {
let
sshkeypathandidentityfilesplit
=
sharedsshkeypathandidentityfile
.
split
(
separator
:
"/"
)
guard
sshkeypathandidentityfilesplit
.
count
>
2
else
{
// If anything goes wrong set to default global values
return
userHomeDirectoryPath
+
"/.ssh/"
+
"/"
+
identityfile
return
userHomeDirectoryPath
+
"/.ssh/"
+
"/"
+
identityfile
only
}
return
userHomeDirectoryPath
+
sshkeypathandidentityfilesplit
.
joined
(
separator
:
"/"
)
.
dropFirst
()
}
else
{
// If anything goes wrong set to default global values
return
userHomeDirectoryPath
+
"/.ssh"
+
"/"
+
identityfile
return
userHomeDirectoryPath
+
"/.ssh"
+
"/"
+
identityfile
only
}
}
else
if
let
userHomeDirectoryPath
{
return
userHomeDirectoryPath
+
"/.ssh"
+
"/"
+
identityfile
return
userHomeDirectoryPath
+
"/.ssh"
+
"/"
+
identityfile
only
}
return
nil
}
// SSH identityfile with full keypath if NOT default is used
// If default, only return defalt value
public
var
identityfile
:
String
{
public
var
identityfile
only
:
String
{
if
let
sharedsshkeypathandidentityfile
{
if
sharedsshkeypathandidentityfile
.
first
==
"~"
{
// must drop identityfile and then set rootpath
...
...
@@ -78,7 +78,7 @@ public final class SSHCreateKey {
// Used when creating ssh keypath
// default keypath - Users/thomas/ssh
// user set keypath - Users/thomas/.ssh_global
// If not created retu
n
r nil
// If not created retur
n
nil
// NO trailing "/"
public
var
sshkeypath
:
String
?
{
...
...
@@ -212,7 +212,7 @@ public final class SSHCreateKey {
}
else
{
if
let
sshkeypath
{
args
.
append
(
sshkeypath
+
"/"
+
identityfile
)
args
.
append
(
sshkeypath
+
"/"
+
identityfile
only
)
}
}
return
args
...
...
@@ -220,7 +220,7 @@ public final class SSHCreateKey {
public
func
validatepublickeypresent
()
->
Bool
{
if
let
allsshkeyfiles
{
let
publickey
=
identityfile
.
appending
(
".pub"
)
let
publickey
=
identityfile
only
.
appending
(
".pub"
)
return
allsshkeyfiles
.
contains
(
publickey
)
}
return
false
...
...
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