examples: support plain username credentials Implement plain username credential types. These type of credentials might be asked for e.g. as some kind of pre-authentication step, before the actual credentials are passed.
diff --git a/examples/common.c b/examples/common.c
index ee47107..aae9f97 100644
--- a/examples/common.c
+++ b/examples/common.c
@@ -362,6 +362,11 @@ int cred_acquire_cb(git_cred **out,
goto out;
error = git_cred_userpass_plaintext_new(out, username, password);
+ } else if (allowed_types & GIT_CREDTYPE_USERNAME) {
+ if ((error = ask(&username, "Username:")) < 0)
+ goto out;
+
+ error = git_cred_username_new(out, username);
}
out: