src-d / go-git

Project has been moved to: https://github.com/go-git/go-git
https://github.com/go-git/go-git
Apache License 2.0
4.91k stars 542 forks source link

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

Open ahmetb opened 4 years ago

ahmetb commented 4 years ago

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.

kamiyaa commented 4 years ago

Having the same problem

mcuadros commented 4 years ago

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.