complete SSH Key authentication

This commit is contained in:
Bob Sun 2017-01-31 22:00:50 +08:00
parent 7a3f05701b
commit 62e2a7fe89
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
4 changed files with 15 additions and 5 deletions

View file

@ -58,7 +58,11 @@ class PasswordStore {
if Defaults[.pgpKeyID] != "" {
pgp.importKeys(fromFile: Globals.shared.secringPath, allowDuplicates: false)
}
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositoryPassword]))
if Defaults[.gitRepositoryAuthenticationMethod] == "Password" {
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositoryPassword]))
} else {
gitCredential = GitCredential(credential: GitCredential.Credential.ssh(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositorySSHPrivateKeyPassphrase]!, publicKeyFile: Defaults[.gitRepositorySSHPublicKeyURL]!, privateKeyFile: Defaults[.gitRepositorySSHPrivateKeyURL]!))
}
}