You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows only - Git ssh passphrase not remembered #12401
ERROR Error connecting to agent: No such file or directory; LOGGED FROM: void __cdecl rstudio::session::modules::git::`anonymous-namespace'::addKeyToSSHAgent_onCompleted(const struct rstudio::core::system::ProcessResult &) C:\Users\jenkins\workspace\ide\open-source-pipeline\elsbeth-geranium\src\cpp\session\modules\SessionGit.cpp:2590
I wonder if the problem here is that the path to the key file you're seeing is a MinGW path (/c/Users/Jon/.ssh/id_ed25519; note the /c/ prefix rather than C:/`).
Setup ssh key with passphrase for git/github
Can you confirm the steps you used to set up the key?
I also sort of wonder if this is a PATH issue; e.g. perhaps the wrong version of ssh-add or ssh-agent is being invoked here. Can you share the output of:
echo $PATH
which ssh-add
which ssh-agent
from an RStudio terminal?
The version of Git Bash installed may also be helpful.
Looks like I forgot to answer a question from before. I originally setup my ssh keys with either windows cmd or powershell. I know I didn't use git-bash.
I suspect the problem is the presence of multiple ssh implementations (e.g. the one in Windows and the one in Git for Windows).
The below describes the problem we are seeing: "Otherwise you might be asked to introduce the passphrase on each git command call that connects to a remote repository."
If you choose to use OpenSSH that comes with git during installation (default option) and wish to work from Windows' Command Prompt (cmd) or PowerShell instead of Git Bash you should make sure:
You're calling the correct executables.
Windows comes with a different OpenSSH distribution and by default you might be calling it while git commands use its own. Set the environment PATH to use the git installation ssh commands first, those are usually at C:\Program Files\Git\usr\bin.
In CMD: set PATH=C:\Program Files\Git\usr\bin;%PATH%
In PowerShell: $Env:PATH = "C:\Program Files\Git\usr\bin;$Env:PATH"
This will make sure, for example, that you add the private keys to the correct ssh-agent service when calling ssh-add. Otherwise you might be asked to introduce the passphrase on each git command call that connects to a remote repository.
Git's ssh is able to connect to the ssh-agent.
In order to connect to the ssh-agent service, git's ssh needs to know how. This is accomplished by two environment variables called SSH_AGENT_PID and SSH_AUTH_SOCK. Luckily, there is a convenient script start-ssh-agent.cmd included with the git installation you can call to set this up. The values are dynamic and only valid after calling the script. Forgetting to set them will fail silently, so be sure to call the script each time you open a new command prompt.
Our code currently sets SSH_AGENT_PID but does not set SSH_AUTH_SOCK. We probably need to tweak paths to ensure we're using the git ssh, and set that other env var.
Also curious if it's possible to use the Windows ssh implementation with the git for windows ssh-agent. If so, we might need to let the user configure which ssh they want to use.
Activity
jonvanausdeln commentedon Dec 6, 2022
This happens both in the git pane and in terminal.
kevinushey commentedon Dec 7, 2022
RStudio tries to use the SSH agent to remember keys here, e.g.
rstudio/src/cpp/session/modules/SessionGit.cpp
Lines 2676 to 2680 in 1ab0a77
Presumedly something is going wrong here? Do you see any errors in the logs?
jonvanausdeln commentedon Dec 7, 2022
Yes, there is now that I checked.
jonvanausdeln commentedon Dec 7, 2022
I also just checked Spotted Wakerobin and get the same issue.
kevinushey commentedon Dec 8, 2022
I wonder if the problem here is that the path to the key file you're seeing is a MinGW path (
/c/Users/Jon/.ssh/id_ed25519; note the/c/ prefix rather thanC:/`).Can you confirm the steps you used to set up the key?
I also sort of wonder if this is a PATH issue; e.g. perhaps the wrong version of
ssh-addorssh-agentis being invoked here. Can you share the output of:from an RStudio terminal?
The version of Git Bash installed may also be helpful.
mikebessuille commentedon Dec 12, 2022
https://apple.stackexchange.com/a/250572/324264 provides some ideas on how to fix this in the OS. We need to do a bunch of fixes to our Git client - will be after we fix Data Viewer, fixing plot problems,...
5 remaining items
jonvanausdeln commentedon Mar 21, 2024
Looks like I forgot to answer a question from before. I originally setup my ssh keys with either windows cmd or powershell. I know I didn't use git-bash.
jthomasmock commentedon Mar 27, 2024
We can do an exploration for Cranberry Hibiscus. 🕐 + 🗳 + 🔎
gtritchie commentedon Oct 20, 2024
I suspect the problem is the presence of multiple ssh implementations (e.g. the one in Windows and the one in Git for Windows).
The below describes the problem we are seeing: "Otherwise you might be asked to introduce the passphrase on each git command call that connects to a remote repository."
https://github.com/git-for-windows/git/wiki/FAQ#running-without-git-bash
Our code currently sets SSH_AGENT_PID but does not set SSH_AUTH_SOCK. We probably need to tweak paths to ensure we're using the git ssh, and set that other env var.
Also curious if it's possible to use the Windows ssh implementation with the git for windows ssh-agent. If so, we might need to let the user configure which ssh they want to use.
gtritchie commentedon Oct 28, 2024
We would really like to fix this but not going to have time in this release. Bumping yet again.