mirror of
https://github.com/godotengine/godot-git-plugin.git
synced 2026-01-01 01:48:28 +03:00
Address issue #172, to use public key path if present in preference
to using password.
This commit is contained in:
1
.gitmodules
vendored
1
.gitmodules
vendored
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user