Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
juanique opened this issue Oct 29, 2023 · 1 comment

Comments

@juanique
Copy link

juanique commented Oct 29, 2023

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

@juanique
Copy link
Author

It turns out the issue is because I'm using the zig C toolchain and I'm hitting this bug: ziglang/zig#11878

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant