File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -451,7 +451,6 @@ where
451
451
let mut ssh_agent_attempts = Vec :: new ( ) ;
452
452
let mut any_attempts = false ;
453
453
let mut tried_sshkey = false ;
454
- let mut tried_cred_helper = false ;
455
454
456
455
let mut res = f ( & mut |url, username, allowed| {
457
456
any_attempts = true ;
@@ -504,8 +503,12 @@ where
504
503
// but we currently don't! Right now the only way we support fetching a
505
504
// plaintext password is through the `credential.helper` support, so
506
505
// 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 ( ) {
509
512
let r = git2:: Cred :: credential_helper ( cfg, url, username) ;
510
513
cred_helper_bad = Some ( r. is_err ( ) ) ;
511
514
return r;
You can’t perform that action at this time.
0 commit comments