             return
         }
 
-        func checkUsername() {
-            if gitURL.user == nil && usernameTextField.text == nil {
-                Utils.alert(title: "CannotSave".localize(), message: "CannotFindUsername.".localize(), controller: self, completion: nil)
-                return
-            }
-            if let urlUsername = gitURL.user, let textFieldUsername = usernameTextField.text, urlUsername != textFieldUsername.trimmed {
-                Utils.alert(title: "CannotSave".localize(), message: "CheckEnteredUsername.".localize(), controller: self, completion: nil)
-                return
-            }
-        }
-
         if let scheme = gitURL.scheme {
             switch scheme {
-            case "ssh", "http", "https", "file": checkUsername()
+            case "ssh", "http", "https":
+                if gitURL.user == nil && usernameTextField.text == nil {
+                    Utils.alert(title: "CannotSave".localize(), message: "CannotFindUsername.".localize(), controller: self, completion: nil)
+                    return
+                }
+                if let urlUsername = gitURL.user, let textFieldUsername = usernameTextField.text, urlUsername != textFieldUsername.trimmed {
+                    Utils.alert(title: "CannotSave".localize(), message: "CheckEnteredUsername.".localize(), controller: self, completion: nil)
+                    return
+                }
+            case "file": break
             default:
                 Utils.alert(title: "CannotSave".localize(), message: "Protocol is not supported", controller: self, completion: nil)
                 return

    private func requestGitPassword(credential: GitCredential.Credential, lastPassword: String?) -> String? {
        let sem = DispatchSemaphore(value: 0)
        var password: String?
        var message = ""
        switch credential {
        case .http:
            message = "FillInGitAccountPassword.".localize()
        case .ssh:
            message = "FillInSshKeyPassphrase.".localize()
        }

        DispatchQueue.main.async {
            SVProgressHUD.dismiss()
            let alert = UIAlertController(title: "Password".localize(), message: message, preferredStyle: UIAlertController.Style.alert)
            alert.addTextField(configurationHandler: {(textField: UITextField!) in
                textField.text = lastPassword ?? ""
                textField.isSecureTextEntry = true
            })
            alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
                password = alert.textFields!.first!.text
                sem.signal()
            }))

            let deleteAction = UIAlertAction(title: "RemoveSShKeys".localize(), style: .destructive) { _ in
                self.passwordStore.removeGitSSHKeys()
                SharedDefaults[.gitSSHKeySource] = nil
                self.sshLabel?.isEnabled = false
                self.updateAuthenticationMethodCheckView(for: .password)
            }
            optionMenu.addAction(deleteAction)
        }
