mirror of
https://github.com/grdl/git-get.git
synced 2026-02-04 16:14:48 +00:00
21 lines
437 B
Go
21 lines
437 B
Go
package main
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
|
|
git "github.com/libgit2/git2go/v30"
|
|
)
|
|
|
|
func CloneRepo(url string, path string) (*git.Repository, error) {
|
|
options := &git.CloneOptions{
|
|
CheckoutOpts: nil,
|
|
FetchOptions: nil,
|
|
Bare: false,
|
|
CheckoutBranch: "",
|
|
RemoteCreateCallback: nil,
|
|
}
|
|
|
|
repo, err := git.Clone(url, path, options)
|
|
return repo, errors.Wrap(err, "Failed cloning repo")
|
|
}
|