MCPcopy
hub / github.com/git-lfs/git-lfs / SSHTransfer

Method SSHTransfer

lfsapi/lfsapi.go:55–76  ·  view source on GitHub ↗

SSHTransfer returns either an suitable transfer object or nil if the server is not using an SSH remote or the git-lfs-transfer style of SSH remote.

(operation, remote string)

Source from the content-addressed store, hash-verified

53// server is not using an SSH remote or the git-lfs-transfer style of SSH
54// remote.
55func (c *Client) SSHTransfer(operation, remote string) *ssh.SSHTransfer {
56 if len(operation) == 0 {
57 return nil
58 }
59 endpoint := c.Endpoints.Endpoint(operation, remote)
60 if len(endpoint.SSHMetadata.UserAndHost) == 0 {
61 return nil
62 }
63 uc := config.NewURLConfig(c.context.GitEnv())
64 if val, ok := uc.Get("lfs", endpoint.OriginalUrl, "sshtransfer"); ok && val != "negotiate" && val != "always" {
65 tracerx.Printf("skipping pure SSH protocol connection by request (%s, %s)", operation, remote)
66 return nil
67 }
68 ctx := c.Context()
69 tracerx.Printf("attempting pure SSH protocol connection (%s, %s)", operation, remote)
70 sshTransfer, err := ssh.NewSSHTransfer(ctx.OSEnv(), ctx.GitEnv(), &endpoint.SSHMetadata, operation)
71 if err != nil {
72 tracerx.Printf("pure SSH protocol connection failed (%s, %s): %s", operation, remote, err)
73 return nil
74 }
75 return sshTransfer
76}

Callers 2

getClientMethod · 0.80
newConcreteManifestFunction · 0.80

Calls 7

GetMethod · 0.95
ContextMethod · 0.95
NewURLConfigFunction · 0.92
NewSSHTransferFunction · 0.92
EndpointMethod · 0.65
GitEnvMethod · 0.65
OSEnvMethod · 0.65

Tested by

no test coverage detected