diff --git a/src/scmrepo/git/credentials.py b/src/scmrepo/git/credentials.py index 61485ef9..c37d1394 100644 --- a/src/scmrepo/git/credentials.py +++ b/src/scmrepo/git/credentials.py @@ -256,6 +256,8 @@ def get_matching_commands( except KeyError: # no helper configured continue + if not command: + continue use_http_path = conf.get_boolean(section, "usehttppath", False) yield ( command.decode(conf.encoding or sys.getdefaultencoding()), diff --git a/tests/test_credentials.py b/tests/test_credentials.py index 853e3425..3a821d47 100644 --- a/tests/test_credentials.py +++ b/tests/test_credentials.py @@ -201,3 +201,20 @@ def test_get_matching_commands(): assert list( GitCredentialHelper.get_matching_commands("https://foo.com/foo.git", config) ) == [("/usr/local/bin/my-helper", False)] + + config_file = io.BytesIO( + """ +[credential] + helper = +""".encode( + "ascii" + ) + ) + config_file.seek(0) + config = ConfigFile.from_file(config_file) + assert ( + list( + GitCredentialHelper.get_matching_commands("https://foo.com/foo.git", config) + ) + == [] + )