Skip to content

libgit.Clone produces empty directory, fails with failed to stat path/to/repo/.git #957

Closed
@juanique

Description

@juanique

I'm doing this:

if libgit.Features()&libgit.FeatureSSH != 0 {
	fmt.Println("libgit2 has SSH support!")
} else {
	fmt.Println("libgit2 does not have SSH support.")
}

repo, err := libgit.Clone(repoURL, localPath, &libgit.CloneOptions{})
if err != nil {
	return nil, fmt.Errorf("error cloning repository %s to %s: %w", repoURL, localPath, err)
}
defer repo.Free()

The code fails with:

libgit2 has SSH support!

error cloning repository git@github.com/juanique/bazel-examples.git to /home/juanique/ggo/bazel-examples: failed to stat '/home/juanique/ggo/bazel-examples/.git':

I see that the directory /home/juanique/ggo/bazel-examples was created and it's empty.

I don't know if it is relevant but I'm running Ubuntu with WSL2 on Windows and building my go binary using bazel with cgo for the libgit2 dependency.

I'm using git2go@v33

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions