可以使用 libgit2 克隆 git 存储库吗?
有没有办法使用 libgit2 创建 git 存储库的新克隆?从 libgit2 使用指南 (http://libgit2.github.com/api.html),各种示例文档(http://schacon.github.com/libgit2-examples/ 等)和“存储库”libgit2 api 文档(http://libgit2.github.com/libgit2/group__git__repository .html)和其他阅读...我只看到有关打开现有 git repo 目录(git_repository_open
)或创建新目录(git_repository_init
)的引用。
我是否缺少一些明显的东西?也许相当于“git clone GIT-REPO-URL”的 api 是 git_repository_init
后跟 ... ?
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 ... ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Libgit2确实是一项正在进行中的工作...但看起来事情进展很快:)
现在可以从远程存储库获取。您可以在此 StackOverflow 答案中找到一些代码示例的指针。
更新
克隆功能刚刚合并到libgit2中存储库。
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.
Update
The clone feature has just been merged into the libgit2 repository.
我已将此功能贡献给 libgit2 的 python 绑定;)
现在您也可以在 python 中克隆。
希望有帮助!
I've contributed this feature to the python binding of libgit2 ;)
Now you can clone in python as well.
Hope it helps!
不,libgit2 中尚未实现这一点。据我所知,libgit2 中还没有实现任何网络协议。 libgit2 仍在进行中;它对于检查和操作本地存储库很有用,但对于执行网络操作还不够。目前,如果您想要执行克隆(甚至本地克隆)等网络操作,则只需使用常规的 git 可执行文件即可。
No, that's not yet implemented in libgit2. None of the network protocols are yet implemented in libgit2 as far as I know. libgit2 is still a work in progress; it is useful for inspecting an manipulating a local repository, but not for doing network operations yet. For now, if you want to do network operations like cloning (or even local cloning), you are going to need to just shell out to the regular
git
executable.