-
Notifications
You must be signed in to change notification settings - Fork 325
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
git: SSH config not respected #63
Comments
Thanks for your report. I'll be away from my computer for about a week from now. If anyone feels like looking into this while I'm away, I think the right place to start is here. |
libgit2 uses libssh2, not OpenSSH, so of course it doesn't use OpenSSH's configuration. And unfortunately there is no support for proxying at all. See libgit2/libgit2#4872 (one linked PR does something in that direction)
Hopefully the hardcoded |
By the way, Git has its "credential helpers", which may be what we should use. I don't know enough about it yet. |
Is it possible to use OpenSSH instead of libssh2? |
I was going to say that I think we'd have to ask for such support from libgit2 (or switch to gitoxide or something) but I see you've already asked there (thanks). I have no idea how feasible it is. |
@bergkvist One alternative is what I do: I never use |
@arxanas Do you have to rerun |
|
Wow, that's great news! Thanks for the update. Will you get a chance to try it? |
I tested it out now, but I'm getting a segfault when using a git remote like
|
The above segfault has been fixed. Also, I had to enable SSH exec support in git2-rs (bergkvist/git2-rs@9a4d232). You can test out installing my patched version like this:
For jj, I guess this will be a matter of upgrading git2-rs once the change has propagated there - possibly with a feature flag specifying ssh exec instead of libssh2. |
I do use an
|
I think it's #1970, and should be fixed in the next release. For now, you can try installing jj from the git repo, or |
Confirmed that
|
libgit2/libgit2#6617 was just merged 🎉 So now it has to get released, git2-rs updated to enable the feature flag with a cargo feature flag, and then we can update git2-rs and enable the feature flag and it should just work, as @bergkvist showed |
I am now running into this issue as well. I am using the 1Password IdentityAgent (so my ssh keys are not directly present in
Is this configuration simply not supported or is there some workaround I can do to get this to work? |
I've made a PR which attempts to upstream libgit2/libgit2#6617 into git2-rs: rust-lang/git2-rs#1031. However, libgit2 still has not made an official release with the OpenSSH changes, so it might take a while for the changes to propagate. I've tried building a version of jj with a prerelease version of git2-rs, and things are looking somewhat promising: (My changes are at https://github.com/bnjmnt4n/jj/tree/ssh-openssh if anyone is interested in trying it out.) |
For now, if anyone's interested in testing:
|
Nice work @bnjmnt4n! I gave it a try locally and get the same result as you: |
|
I realized the issue, there have been changes to the For now, I think you can treat the above repo as slightly suspect, even if it appears to work. |
finding ffi changes should be easy, just diff include/ from last released version in libgit2 |
looks like git_push_options struct changed in libgit2, that explains the segfault |
Yeah, I've updated the my |
I've updated my fork to include the a now fully functional copy of |
Thanks for the fork! First few experiments work well with my 1Password-based SSH setup. FWIW It would also be good to update this error message since libssh2 would no longer be in use. |
Seems to work! Will be using this thanks for doing this @bnjmnt4n |
FYI: it was pointed out on Discord that the |
@bnjmnt4n That does indeed work. The issue I'm having is I have multiple ssh keys managed by 1Password. It does successfully access the 1Password ssh agent, but it just picks the first key alphabetically. For stock git I have |
@MikeJCusack if you still require some configuration in |
I was able to specify which key is provided first by creating the |
Although I suppose it can be improved by configuring the 1Password agent to remember the authorization for longer. I currently have it set to the default of until 1Password locks. |
FYI: in order to get this to work:
I had to run |
Hi all, I depend on this issue to be solved in order for me to be able to introduce jj at my company. This is why I would like to offer help testing or anything else that is needed. I am a complete noob when it comes to rust but would not mind a few pointers. Please let me know what I can do to help this issue along. |
@jessie828 This feature is dependent on patches landing upstream in git-rs. There isn't really much that can happen in jujutsu itself until support has landed in that project. If you are wanting to help out somehow I would recommend looking there. |
In my case there's a simple workaround: the only part of the ssh config I needed was the jj git remote set-url origin "ssh://${REMOTE_USER?}@${REMOTE_URL?}" |
My problem is I need it to respect my Config Where I have some proxy settings declared. Am i maybe doing something wrong? |
As mentioned above, reading from the SSH config file is not supported in Jujutsu currently. We're currently blocked on a PR made to an upstream project which requires further input (rust-lang/git2-rs#1031). However, you're welcome to build a custom jj binary with the following PR #3191 which has been reported to function properly (with regards to reading SSH configuration). |
Expected Behaviour
jj git clone
should respect the SSH config (~/.ssh/config
).Actual Behaviour
The SSH config is not respected, which may be problematic in some cases. In this case,
ProxyCommand
is to communicate with a private Git server.Steps to Reproduce the Problem
~/.ssh/config
to work.jj git clone
hang.Specifications
0.2.0.r917.2916cb2-1
The text was updated successfully, but these errors were encountered: