fix bugs in the first startup
This commit is contained in:
parent
302f544ddb
commit
dd36e87959
1 changed files with 5 additions and 3 deletions
|
|
@ -43,7 +43,7 @@ class PasswordStore {
|
||||||
|
|
||||||
let storeURL = URL(fileURLWithPath: "\(Globals.shared.documentPath)/password-store")
|
let storeURL = URL(fileURLWithPath: "\(Globals.shared.documentPath)/password-store")
|
||||||
var storeRepository: GTRepository?
|
var storeRepository: GTRepository?
|
||||||
var gitCredential: GitCredential
|
var gitCredential: GitCredential?
|
||||||
|
|
||||||
let pgp: ObjectivePGP = ObjectivePGP()
|
let pgp: ObjectivePGP = ObjectivePGP()
|
||||||
|
|
||||||
|
|
@ -61,8 +61,10 @@ class PasswordStore {
|
||||||
}
|
}
|
||||||
if Defaults[.gitRepositoryAuthenticationMethod] == "Password" {
|
if Defaults[.gitRepositoryAuthenticationMethod] == "Password" {
|
||||||
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositoryPassword]))
|
gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositoryPassword]))
|
||||||
} else {
|
} else if Defaults[.gitRepositoryAuthenticationMethod] == "SSH Key"{
|
||||||
gitCredential = GitCredential(credential: GitCredential.Credential.ssh(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositorySSHPrivateKeyPassphrase]!, publicKeyFile: Globals.shared.sshPublicKeyPath, privateKeyFile: Globals.shared.sshPrivateKeyPath))
|
gitCredential = GitCredential(credential: GitCredential.Credential.ssh(userName: Defaults[.gitRepositoryUsername], password: Defaults[.gitRepositorySSHPrivateKeyPassphrase]!, publicKeyFile: Globals.shared.sshPublicKeyPath, privateKeyFile: Globals.shared.sshPrivateKeyPath))
|
||||||
|
} else {
|
||||||
|
gitCredential = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +122,7 @@ class PasswordStore {
|
||||||
print("pullRepoisitory")
|
print("pullRepoisitory")
|
||||||
do {
|
do {
|
||||||
print("start pulling...")
|
print("start pulling...")
|
||||||
let credentialProvider = try gitCredential.credentialProvider()
|
let credentialProvider = try gitCredential!.credentialProvider()
|
||||||
let options: [String: Any] = [
|
let options: [String: Any] = [
|
||||||
GTRepositoryRemoteOptionsCredentialProvider: credentialProvider
|
GTRepositoryRemoteOptionsCredentialProvider: credentialProvider
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue