我想在bitbucket中从我的存储库中克隆特定标记。现在我能够克隆整个存储库。我应该在代码中添加什么来克隆特定标记?
我已经看过了,但它并没有真正帮助我:
https://github.com/libgit2/git2go/issues/126
git_libgit2_init();
int num = 0;
git_clone_options clone_opts = GIT_CLONE_OPTIONS_INIT;
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
clone_opts.checkout_opts = checkout_opts;
clone_opts.fetch_opts.callbacks.credentials = cred_acquire_cb;
git_repository * cloned_repo = NULL;
int error = git_clone(& cloned_repo,all_urls.at(num).c_str(), clone_to.at(num).c_str(),& clone_opts);
if(错误!= 0){
const git_error *err = giterr_last();
cerr << "error in clone num " << num << " -> message :" << err->message << endl;
}
其他cout&lt;&lt; endl&lt;&lt; “克隆”&lt;&lt; num&lt;&lt; “成功”&lt;&lt; “(来自url:”&lt;&lt;&lt; all_urls.at(num)&lt;&lt;“&lt;&lt;&lt;”to path:“&lt;&lt;&lt; clone_to.at(num)&lt;&lt;”)“&lt; &LT; ENDL;
git_repository_free(cloned_repo);
git_libgit2_shutdown();
感谢您的时间