File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,28 @@ import (
1313// dialAgent returns an ssh.Agent client. It uses the SSH_AUTH_SOCK to connect
1414// to the agent.
1515func dialAgent () (* Agent , error ) {
16- // Attempt unix sockets for environments like cygwin.
16+ // Override the default windows openssh-ssh-agent pipe
1717 if socket := os .Getenv ("SSH_AUTH_SOCK" ); socket != "" {
18+ // Attempt unix sockets for environments like cygwin.
1819 if conn , err := net .Dial ("unix" , socket ); err == nil {
1920 return & Agent {
2021 ExtendedAgent : agent .NewClient (conn ),
2122 Conn : conn ,
2223 }, nil
2324 }
25+
26+ // Connect to Windows pipe at the supplied address
27+ conn , err := winio .DialPipeContext (context .Background (), socket )
28+ if err != nil {
29+ return nil , errors .Wrap (err , "error connecting with ssh-agent at pipe specified by environment variable SSH_AUTH_SOCK" )
30+ }
31+ return & Agent {
32+ ExtendedAgent : agent .NewClient (conn ),
33+ Conn : conn ,
34+ }, nil
2435 }
2536
26- // Windows OpenSSH agent
37+ // DEFAULT: Windows OpenSSH agent
2738 conn , err := winio .DialPipeContext (context .Background (), `\\.\\pipe\\openssh-ssh-agent` )
2839 if err != nil {
2940 return nil , errors .Wrap (err , "error connecting with ssh-agent" )
You can’t perform that action at this time.
0 commit comments