Skip to content
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

"Use a Git executable" ignore ssh-agent #5515

Open
Andrysky opened this issue Nov 11, 2024 · 6 comments
Open

"Use a Git executable" ignore ssh-agent #5515

Andrysky opened this issue Nov 11, 2024 · 6 comments
Labels
auth* Issues with authentication and authorisation, usually with forges bug Something isn't working

Comments

@Andrysky
Copy link

Version

0.13.13

Operating System

macOS

Distribution Method

dmg (Apple Silicon)

Describe the issue

I use ssh-agent to access git
(the key is not in the file - so I can't select "Use an existing SSH key")
git exist on PATH - and all work from CLI

How to reproduce

select Use a Git executable (default)
press "test credentials"

Expected behavior

all work

Relevant log output

There was a problem with your credentials
Fetch - Error: Git command exited with non-zero exit code 128: ["fetch", "--quiet", "--prune", "origin", "+refs/heads/*:refs/remotes/origin/*"] STDOUT: STDERR: Connection closed by ___.___.___.___ port ___
 fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
@Andrysky Andrysky added the bug Something isn't working label Nov 11, 2024
@Byron
Copy link
Collaborator

Byron commented Nov 12, 2024

Thanks for reporting!

Can you try to launch GitButler from the terminal directly? This would be the typical path on MacOS:

/Applications/GitButler.app/Contents/MacOS/gitbutler-tauri

If this works, that would mean that your setup works due to environment variables which are only available in login shells, and which won't be inherited by GUI applications by default.
I am looking forward to hearing how this panned out.

@Byron Byron added the feedback requested Feedback was requested to help resolve the issue label Nov 12, 2024
@Andrysky
Copy link
Author

when launched from the console, everything works.
yes, I have SSH_AUTH_SOCK registered in .zshrc / .bash_profile
but vscode did not require additional configuration...

I believe that we need either to be able to set SSH_AUTH_SOCK in the application (in this case, the string specified in SSH_AUTH_SOCK should be interpreted)
or for gitbutler to do this via the console..

@Byron Byron added auth* Issues with authentication and authorisation, usually with forges and removed feedback requested Feedback was requested to help resolve the issue labels Nov 13, 2024
@Byron
Copy link
Collaborator

Byron commented Nov 13, 2024

Thanks for sharing!

It's particularly interesting that VSCode can do it and I wonder how they do it. Probably GitButler could do something very similar, or even the same.

@Andrysky
Copy link
Author

basically as far as I can see they use git
image

@Byron
Copy link
Collaborator

Byron commented Nov 14, 2024

Thanks so much for sharing!

From what I see there, VSCode spawns Git as direct child, there is no login shell involved. If that works, this would mean it has picked up the respective login-shell variables somewhere else.
Definitely something to investigate further.

@ndom91
Copy link
Contributor

ndom91 commented Nov 14, 2024

Taking a quick look at their repo, it looks like they used to fallback to spawning ssh-agent -s which prints the env vars to stdout (from a fork: https://github.com/alarr46/vscode/blob/722e4edbb2fde33742a6896b7989d59cb3c14c47/extensions/git/src/git.ts#L324-L351)

However, I can't find that code in master anymore. They don't seem to reference ssh-agent or SSH_AUTH_SOCK anywhere so I'm double-y curious how they're doing this nowadays haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth* Issues with authentication and authorisation, usually with forges bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants