0

So far I've nearly got the setup I want for using GIT (Windows). All works fine from Git bash with SSH, Passphrases, the SSH config file and SSH-Agent.

But I can only communicate with any remote Repo's if I start Visual Studio from GitBash terminal by running "code"

This will be because the environment from the bash terminal is passed on to VSCode. I'm thinking I can get VSCode to do this without having to initiate it from the GitBash terminal if I can get the SSH-AGENT environment variables added to the VSCode environment somehow.

i.e. SSH_AUTH_SOCK and SSH_AGENT_PID.

Could there be a way to set these environment variables on startup of Code? This is assuming the SSH-Agent is already running with pre-defined values for those two variables. It's there, I just need to tell Code where to find it.

I've configured most of my setup as per: http://letsdosql.blogspot.co.uk/2018/04/accessing-git-part-2-ssh.html

And with the ssh .config file: https://developer.atlassian.com/blog/2016/04/different-ssh-keys-multiple-bitbucket-accounts/

Thanks in advance!

ScubaManDan
  • 809
  • 8
  • 22
  • So I think I'm looking at this all wrong. Running code from GitBash (sh.exe) seems to initiate VSCode as a child process, thereby inheriting the environment from bash. I'd like to have it do this automatically whenver starting code, so I created a new schortcut. "C:\Program Files\Git\bin\sh.exe" --login -i -c "code && exit" Better. But it still leaves a terminal open after it opens Code. If I close the terminal Code is still fine and can access SSH-AGENT. If I close Code, the shell terminal closes as well. But I would like to have no terminal open once Code is up and running. – ScubaManDan Apr 12 '18 at 20:13

1 Answers1

0

Ok. So the purpose of this was to open VSCode while being able to make use of SSH-Agent... without having to manually open up GitBash and start code from there. So all I've done is create a shortcut to a .sh script file which simply has "code" in it.

If I call the script via sh.exe, it still leaves a terminal window open while just referring to a .sh file directly does not. Also, now sessions of Code can access the SSH-Agent.

The only downside is if I start VCSode from a context menu it doesn't, but this works for me for now.

ScubaManDan
  • 809
  • 8
  • 22