-
Notifications
You must be signed in to change notification settings - Fork 173
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
allow to use ssh agent globally #19
Conversation
Git can be used in separated consoles or in different programs (VSCode, GitExtensions,..) and all of them has to have access to started ssh-agent. But this require global SSH-variables. Here is my solution for that.
Maybe the script can also verify before starting an agent that no other agent is running already? We will also have to think about the scenario where a native OpenSSH ( |
About that native OpenSSH conflict: see git-for-windows/git#1683 for more details. And once we sorted that out, we should probably move this PR (and the 32-bit one) to git-for-windows/MINGW-packages, as the original file (that is installed into the SDK via updates of the |
|
Yes, but the problem there is that it does interfere with other SSH agents, e.g. if anybody runs a particular instance of Cygwin as part of their day-job project. There are many scenarios where users may run an SSH agent without knowing it. At the moment, Git for Windows' And since the change does not come with any toggle, such users will not only be surprised, but they will be actively thrown into problems they cannot easily solve. I could imagine, however, that we could guard this new And once we have that in place, we can add it as a new option in the installer. |
May be then simpler make separate script |
@dscho I currently trying to make separate script and have question about this line: What did you find by it? I not sure understand the idea. Your finder see |
Yes, but it would also proliferate the number of files in
That is easy to answer: you would warn the user if the config setting is unset, and tell them where/how they can configure whether to configure the SSH agent globally.
@REM Enable extensions, the `verify` call is a trick from the setlocal help
@VERIFY other 2>nul
@SETLOCAL EnableDelayedExpansion
@SET ssh_agent_global=unset
@FOR /F "usebackq tokens=*" %%i IN (`git config --bool ssh.agent.global`) DO @SET ssh_agent_global=%%i
@IF "!ssh_agent_global!" == "unset" (
@ECHO Talk about the config setting, and what we're defaulting to
) ELSE IF "!ssh_agent_global!" == "true" (
@ECHO Replace this with the @SETX calls
)
Except, of course, if the command tells you what you need to know.
I am not sure, either. It was added in msysgit/msysgit@b0657b1 I guess that this was to discern whether the script was double-clicked, or run from an interactive CMD. |
Technically Currently I am more inclined to an argument or a separate script. |
If make additional argument, user on first run will see some kind of hint about our argument to use it globally. And if he require use it globally, he have to:
If make separate script, user can:
Not sure which method is better. But like methods like "just push the button" :) |
Do you mean to disallow women from using this script? I don't. |
As I pointed out, I don't think that a separate script is a good idea. The additional argument would require prior knowledge, and it also won't work if a user double-clicks the script to open a new Console. It would also make it a lot harder to make this visible via the installer. Only a config option could do that. |
Lets sync pros/cons of all solutions: config option: argument: separate script: Can you fill your +/-? |
And about compatibility with Windows native ssh-agent: Your script search in memory |
I already mentioned a rather large pro: it can be configured in the Git for Windows installer, which is the most visible documentation about this feature that most Git for Windows users will ever get.
There is ample precedent for this. It is a Git-related setting, so it belongs into that config.
That is a good point. And I think it is in line with many, many other config settings that it should be possible to configure the default in the Git config, and have a command-line option to override it. |
Let's continue the discussion over at git-for-windows/MINGW-packages#39. |
Git can be used in separated consoles or in different programs (VSCode, GitExtensions,..) and all of them has to have access to started ssh-agent. But this require global SSH-variables.
Here is my solution for that.