Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

SSH connection without SSH-agent #206

@skyflyer

Description

@skyflyer

I'm having an issue connecting to git repository over ssh on windows, where I don't have an SSH agent running.

In ssh/common.go, the command.connect method calls c.setAuthFromEndpoint() which in turn tries to connect with SSH agent and fails. The method's comments note:

connect connects to the SSH server, unless a AuthMethod was set with
SetAuth method...

but for me, that does not work. Here is a brief program that reproduces this issue:

func main() {
	repoURL := "ssh://git@hostname:portnum/testing.git"
	signer := getSSHSigner()
	r := git.NewMemoryRepository()
	err := r.Clone(&git.CloneOptions{
		URL:  repoURL,
		Auth: &gitssh.PublicKeys{User: "git", Signer: signer},
	})
	check(err)
}

The error returned is dial unix: missing address, which is correct (in a way), since there is no SSH agent environment variable available, so there's nowhere to connect to. The getSigner function above retrieves the ssh.Signer from a private key, supplied to the program.

I can prepare a pull request with a fix, if you'd like that; it seems to me, that we would need to reorganise some code, as currently, Auth does not get propagated down to the actual transport layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions