pygit2
pygit2 copied to clipboard
Git HTTP Auth breaks w/1.14
Upgrading to 1.14.0, and cloning via HTTP auth (username + password) gives this stack trace:
File "/opt/conda/lib/python3.10/site-packages/pygit2/remotes.py", line 171, in ls_remotes
self.connect(callbacks=callbacks, proxy=proxy)
File "/opt/conda/lib/python3.10/site-packages/pygit2/remotes.py", line 120, in connect
payload.check_error(err)
File "/opt/conda/lib/python3.10/site-packages/pygit2/callbacks.py", line 93, in check_error
raise self._stored_exception
File "/opt/conda/lib/python3.10/site-packages/pygit2/callbacks.py", line 416, in wrapper
return f(*args)
File "/opt/conda/lib/python3.10/site-packages/pygit2/callbacks.py", line 484, in _credentials_cb
ccred = get_credentials(credentials, url, username, allowed)
File "/opt/conda/lib/python3.10/site-packages/pygit2/callbacks.py", line 569, in get_credentials
creds = fn(url_str, username_str, allowed)
File "/opt/conda/lib/python3.10/site-packages/scmrepo/git/backend/pygit2/callbacks.py", line 51, in credentials
from pygit2.credentials import GIT_CREDENTIAL_USERPASS_PLAINTEXT, UserPass
ImportError: cannot import name 'GIT_CREDENTIAL_USERPASS_PLAINTEXT' from 'pygit2.credentials' (/opt/conda/lib/python3.10/site-packages/pygit2/credentials.py)
Version 1.13.3 works fine though :).
Thanks.
It's an import error. From what I see this has been fixed already in scmrepo 2.1.1
For the record, the old constants are still available in the root package:
from pygit2 import GIT_CREDENTIAL_USERPASS_PLAINTEXT
But it's better to use the new enums, like it's done now in scmrepo.