How to clone/fetch a git repository with libgit2?

元气小坏坏 提交于 2019-12-05 23:50:11

High level steps describing how to implement a fetching process in libgit2 can be found here.

You can find example of codes performing such task here and here. Beware these examples might get a little out of sync as the API is moving on.

Please note that those pieces of code will retrieve all newer commits (a branch is only a pointer to a specific commit) from the upstream defined remote.

As of today, there's no way to perform a checkout in libgit2 yet.

Provided you need some more help, I'd recommend those two places:

  • the libgit2 mailing list (via libgit2@librelist.com)
  • the libgit2 issue tracker

Update

The clone feature has just been merged into the libgit2 repository.

As part of the pull request, the author took care of providing the users with a checkout implementation as well.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!