     
     public func initGitCredential() {
         if Defaults[.gitAuthenticationMethod] == "Password" {
-            gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitUsername]!, password: Utils.getPasswordFromKeychain(name: "gitPassword") ?? ""))
+            gitCredential = GitCredential(credential: GitCredential.Credential.http(userName: Defaults[.gitUsername] ?? "", password: Utils.getPasswordFromKeychain(name: "gitPassword") ?? ""))
         } else if Defaults[.gitAuthenticationMethod] == "SSH Key"{
             gitCredential = GitCredential(
                 credential: GitCredential.Credential.ssh(
-                    userName: Defaults[.gitUsername]!,
+                    userName: Defaults[.gitUsername] ?? "",
                     password: gitSSHPrivateKeyPassphrase ?? "",
                     publicKeyFile: Globals.gitSSHPublicKeyURL,
                     privateKeyFile: Globals.gitSSHPrivateKeyURL,

    
    var gitSignatureForNow: GTSignature {
        get {
            let name = Defaults[.gitName] ?? Defaults[.gitUsername]!
            let email = Defaults[.gitEmail] ?? (Defaults[.gitUsername]!+"@passforios")
            return GTSignature(name: name, email: email, time: Date())!
        }
    }

                let encrypted = try? String(contentsOf: privateKeyFile).contains("ENCRYPTED")

                // Request password if not already set
                if encrypted == nil && password == "" {
                    newPassword = passwordNotSetCallback!()
                }

