diff --git a/.gitmodules b/.gitmodules index b767d60..9118248 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,6 +5,7 @@ [submodule "libgit2"] path = thirdparty/git2/libgit2 url = https://github.com/libgit2/libgit2 + ignore = untracked [submodule "thirdparty/ssh2/libssh2"] path = thirdparty/ssh2/libssh2 url = https://github.com/libssh2/libssh2 diff --git a/godot-git-plugin/src/git_callbacks.cpp b/godot-git-plugin/src/git_callbacks.cpp index e8f896d..4558794 100644 --- a/godot-git-plugin/src/git_callbacks.cpp +++ b/godot-git-plugin/src/git_callbacks.cpp @@ -82,17 +82,20 @@ extern "C" int credentials_cb(git_cred **out, const char *url, const char *usern godot::String proper_username = username_from_url ? username_from_url : creds->username; + if (!creds->ssh_public_key_path.is_empty()) { + if (allowed_types & GIT_CREDENTIAL_SSH_KEY) { + return git_credential_ssh_key_new(out, + CString(proper_username).data, + CString(creds->ssh_public_key_path).data, + CString(creds->ssh_private_key_path).data, + CString(creds->ssh_passphrase).data); + } + } + if (allowed_types & GIT_CREDENTIAL_USERPASS_PLAINTEXT) { return git_cred_userpass_plaintext_new(out, CString(proper_username).data, CString(creds->password).data); } - if (allowed_types & GIT_CREDENTIAL_SSH_KEY) { - return git_credential_ssh_key_new(out, - CString(proper_username).data, - CString(creds->ssh_public_key_path).data, - CString(creds->ssh_private_key_path).data, - CString(creds->ssh_passphrase).data); - } if (allowed_types & GIT_CREDENTIAL_USERNAME) { return git_credential_username_new(out, CString(proper_username).data);