File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -451,7 +451,6 @@ where
451451 let mut ssh_agent_attempts = Vec :: new ( ) ;
452452 let mut any_attempts = false ;
453453 let mut tried_sshkey = false ;
454- let mut tried_cred_helper = false ;
455454
456455 let mut res = f ( & mut |url, username, allowed| {
457456 any_attempts = true ;
@@ -504,8 +503,12 @@ where
504503 // but we currently don't! Right now the only way we support fetching a
505504 // plaintext password is through the `credential.helper` support, so
506505 // fetch that here.
507- if allowed. contains ( git2:: CredentialType :: USER_PASS_PLAINTEXT ) && !tried_cred_helper {
508- tried_cred_helper = true ;
506+ //
507+ // If ssh-agent authentication fails, libgit2 will keep calling this
508+ // callback asking for other authentication methods to try. Check
509+ // cred_helper_bad to make sure we only try the git credentail helper
510+ // once, to avoid looping forever.
511+ if allowed. contains ( git2:: CredentialType :: USER_PASS_PLAINTEXT ) && cred_helper_bad. is_none ( ) {
509512 let r = git2:: Cred :: credential_helper ( cfg, url, username) ;
510513 cred_helper_bad = Some ( r. is_err ( ) ) ;
511514 return r;
You can’t perform that action at this time.
0 commit comments