aboutsummaryrefslogtreecommitdiffstats
path: root/clients/ssh/auth_method.go
diff options
context:
space:
mode:
Diffstat (limited to 'clients/ssh/auth_method.go')
-rw-r--r--clients/ssh/auth_method.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/clients/ssh/auth_method.go b/clients/ssh/auth_method.go
index e55283e..1ce45ef 100644
--- a/clients/ssh/auth_method.go
+++ b/clients/ssh/auth_method.go
@@ -138,16 +138,22 @@ func (a *PublicKeysCallback) clientConfig() *ssh.ClientConfig {
}
}
+const DefaultSSHUsername = "git"
+
// Opens a pipe with the ssh agent and uses the pipe
// as the implementer of the public key callback function.
-func NewSSHAgentAuth() (*PublicKeysCallback, error) {
+func NewSSHAgentAuth(user string) (*PublicKeysCallback, error) {
+ if user == "" {
+ user = DefaultSSHUsername
+ }
+
pipe, err := net.Dial("unix", os.Getenv("SSH_AUTH_SOCK"))
if err != nil {
return nil, err
}
return &PublicKeysCallback{
- User: "git",
+ User: user,
Callback: agent.NewClient(pipe).Signers,
}, nil
}