Skip to content

Instantly share code, notes, and snippets.

@markembling
Created June 12, 2018 13:02
Show Gist options
  • Save markembling/8c201b45085f30d61d9f286d4ef68782 to your computer and use it in GitHub Desktop.
Save markembling/8c201b45085f30d61d9f286d4ef68782 to your computer and use it in GitHub Desktop.
Allow SSH agent installed and managed by posh-git to also be usable from other non-PowerShell processes (e.g. Tower Git client for Windows).
# Add this into your profile AFTER posh-git has been loaded and the SSH agent
# has been started.
[void][Environment]::SetEnvironmentVariable("SSH_AGENT_PID", [Environment]::GetEnvironmentVariable("SSH_AGENT_PID"), [EnvironmentVariableTarget]::User)
[void][Environment]::SetEnvironmentVariable("SSH_AUTH_SOCK", [Environment]::GetEnvironmentVariable("SSH_AUTH_SOCK"), [EnvironmentVariableTarget]::User)
# It may make it a little slower (as apparently writing to the user environment
# is slow), but will mean the SSH agent is visible to other processes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment