Skip to content

Instantly share code, notes, and snippets.

@abstrask
Last active August 23, 2021 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abstrask/f8ea3519659a49961f6e25165c3909a3 to your computer and use it in GitHub Desktop.
Save abstrask/f8ea3519659a49961f6e25165c3909a3 to your computer and use it in GitHub Desktop.
# https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate
<#
In order to configure Git to use the "Windows" OpenSSH (found at %SystemRoot%\System32\OpenSSH),
rather than the one packaged with Git for Windows (at %ProgramFiles%\Git\usr\bin) and enable agent forwarding,
set Git's core.sshCommand configuration property "C:\Windows\System32\OpenSSH\ssh.exe" -T (with double-quotes).
#>
# Using environmental variable GIT_SSH_COMMAND:
[Environment]::SetEnvironmentVariable("GIT_SSH_COMMAND", """$((Get-Command ssh).Source)"" -T", [System.EnvironmentVariableTarget]::User)
# - OR -
# Using Git config (global):
git config --global core.sshCommand "'$((Get-Command ssh).Source)' -T"
# Enable and start the ssh-agent service
Get-Service -Name ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment