-
Notifications
You must be signed in to change notification settings - Fork 15
fetch_refspecs: Use dulwich for ssh urls.
#196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Using pygit2 was causing treeverse/dvc#9080
| get_matching_helper_commands(url, self.dulwich.repo.get_config_stack()) | ||
| ) | ||
| parsed = urlparse(url) | ||
| ssh = parsed.scheme in ("git", "git+ssh", "ssh") or url.startswith("git@") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should maybe be handled here: https://github.com/iterative/scmrepo/blob/e8de01e07edeacae33a9552a1005152b5a153b2a/src/scmrepo/git/backend/pygit2.py#L463-L464
But this may be a different problem entirely if pygit2+SSH is not working on linux/mac. libgit2/pygit2 are supposed to support SSH everywhere except windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the issue is that while it supports SSH, libgit2 doesn't parse openssh configs
https://libgit2.org/docs/guides/authentication/
So we probably need to be using pygit2.RemoteCallbacks and loading the keyfile or user/pass ourselves (we can use asyncssh for this)
pmrowla
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ok as a workaround until we handle libgit2/pygit2 auth callbacks properly
| kwargs["backends"] = ["dulwich"] | ||
| if "dulwich" in kwargs.get("backends", self.backends.backends): | ||
| credentials_helper = any( | ||
| get_matching_helper_commands(url, self.dulwich.repo.get_config_stack()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC credential-helper is not supposed to work for ssh, only for http urls. So this should be fixed in get_matching_helper_commands() or in upstream dulwich.
Regarding ssh not working in pygit2, let's investigate/fix it separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC credential-helper is not supposed to work for ssh, only for http urls. So this should be fixed in get_matching_helper_commands() or in upstream dulwich.
Not sure I understand what you mean. The previous logic is preserved but the change is to also force dulwich if the URL is ssh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_matching_helper_commands should not match anything for ssh urls, so it should not enter this block.
Please try to address comments before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_matching_helper_commands should not match anything for ssh urls, so it should not enter this block.
Sorry, I am still not sure I follow. You mean it should be something like:
if ssh or any(get_matching_helper_commands(url, self.dulwich.repo.get_config_stack()):
Opened #197 |
|
Just manually installed the |
Using pygit2 was causing treeverse/dvc#9080