No need to import SSH public key

This commit is contained in:
Yishi Lin 2017-06-07 01:06:53 +08:00
parent 7bfc3cc7d4
commit a31f5b797d
8 changed files with 38 additions and 122 deletions

View file

@ -17,7 +17,7 @@ struct GitCredential {
enum Credential {
case http(userName: String, controller: UIViewController)
case ssh(userName: String, publicKeyFile: URL, privateKeyFile: URL, controller: UIViewController)
case ssh(userName: String, privateKeyFile: URL, controller: UIViewController)
}
init(credential: Credential) {
@ -44,7 +44,7 @@ struct GitCredential {
attempts += 1
lastPassword = newPassword
credential = try? GTCredential(userName: userName, password: newPassword!)
case let .ssh(userName, publicKeyFile, privateKeyFile, controller):
case let .ssh(userName, privateKeyFile, controller):
var newPassword = Utils.getPasswordFromKeychain(name: "gitSSHKeyPassphrase")
if newPassword == nil || attempts != 0 {
if let requestedPassword = self.requestGitPassword(controller, lastPassword) {
@ -56,7 +56,7 @@ struct GitCredential {
}
attempts += 1
lastPassword = newPassword
credential = try? GTCredential(userName: userName, publicKeyURL: publicKeyFile, privateKeyURL: privateKeyFile, passphrase: newPassword!)
credential = try? GTCredential(userName: userName, publicKeyURL: nil, privateKeyURL: privateKeyFile, passphrase: newPassword!)
}
return credential
}