Is there a way to create a new clone of a git repo using libgit2? From the libgit2 usage guide (http://libgit2.github.com/api.html), various examples docs (http://schacon.github.com/libgit2-examples/ etc.) and the "repository" libgit2 api docs (http://libgit2.github.com/libgit2/group__git__repository.html) and other reading... I only see references to either opening an existing git repo dir, git_repository_open
, or creating a new one, git_repository_init
.
Is there something obvious I am missing? Perhaps the api equivalent of "git clone GIT-REPO-URL" is git_repository_init
followed by ... ?
Libgit2 is indeed a work in progress... but it looks like things are moving fast :)
It is now possible to fetch from a remote repository. You can find some pointers to code samples in this StackOverflow answer.
The clone feature has just been merged into the libgit2 repository.
I've contributed this feature to the python binding of libgit2 ;)
Now you can clone in python as well.
repo_path = "git://github.com/libgit2/pygit2.git"
path = "/tmp/pygit2"
repo = clone_repository(repo_path, path)
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With