go-git icon indicating copy to clipboard operation
go-git copied to clipboard

[v4] git.PlainClone: "remote repository is empty" error from a normal repository

Open ahmetb opened this issue 4 years ago • 2 comments

I'm doing something super straightforward:

	_, err := git.PlainClone(destinationPath, false, &git.CloneOptions{
		URL: "https://github.com/kubernetes-sigs/krew-index.git",
	})
	return err

This returns error remote repository is empty.

I tried os.MkdirAll(destinationPath, 0755) ahead of time, but it doesn't make any difference.

This is purely copied from example at https://godoc.org/gopkg.in/src-d/go-git.v4#example-PlainClone so it's surprising it didn't work out of the box.

ahmetb avatar Mar 06 '20 02:03 ahmetb

Having the same problem

kamiyaa avatar Apr 06 '20 00:04 kamiyaa

Which version are you using? I just executed it with the latest go-git/go-git/v5 and worked. Same URL and code.

Also, will be great if you can open the issue at https://github.com/go-git/go-git, if it still doesn't work. See #1298 and #1295 (comment) for reasons.

mcuadros avatar Apr 06 '20 13:04 mcuadros