git_clone 错误消息断言失败:git_atomic_get(&git__n_inits) > 0
git_clone error message Assertion failed: git_atomic_get(&git__n_inits) > 0
当我尝试git_clone()
(使用libgit2)时,出现了这个错误信息
Assertion failed: git_atomic_get(&git__n_inits) > 0, file C:\data\Install\Git\libgit2-0.25.1\src\global.c, line 199
我的程序被Visual Studio中断:
R6010 - abort() has been called
这是我的代码:
git_repository *cloned_repo = NULL;
cout << all_urls.at(num).c_str() << " -> " << clone_to.at(num).c_str() << endl;
int error = git_clone(&cloned_repo, all_urls.at(num).c_str(),clone_to.at(num).c_str(), &clone_opts);
if (error != 0) {
const git_error *err = giterr_last();
cerr << "error in clone num " << num << " -> message :" << err->message << endl;
}
else cout << endl << "Clone " << num << " succesful" << "(from url : " << all_urls.at(num) << " " << "to path : " << clone_to.at(num) << ")" << endl;
git_repository_free(cloned_repo);
我已经正确设置了clone_opts
(凭证),所以我真的不知道问题在哪里。之前在不同的项目中做过git_clone()
,我也是这样操作的,但是之前没有出现过这样的错误。
谢谢
我忘了在这个方法中调用函数git_libgit2_init()
和git_libgit2_shutdown()
。我在以前的方法中调用了它,我认为我也不必在那里这样做。
当我尝试git_clone()
(使用libgit2)时,出现了这个错误信息
Assertion failed: git_atomic_get(&git__n_inits) > 0, file C:\data\Install\Git\libgit2-0.25.1\src\global.c, line 199
我的程序被Visual Studio中断:
R6010 - abort() has been called
这是我的代码:
git_repository *cloned_repo = NULL;
cout << all_urls.at(num).c_str() << " -> " << clone_to.at(num).c_str() << endl;
int error = git_clone(&cloned_repo, all_urls.at(num).c_str(),clone_to.at(num).c_str(), &clone_opts);
if (error != 0) {
const git_error *err = giterr_last();
cerr << "error in clone num " << num << " -> message :" << err->message << endl;
}
else cout << endl << "Clone " << num << " succesful" << "(from url : " << all_urls.at(num) << " " << "to path : " << clone_to.at(num) << ")" << endl;
git_repository_free(cloned_repo);
我已经正确设置了clone_opts
(凭证),所以我真的不知道问题在哪里。之前在不同的项目中做过git_clone()
,我也是这样操作的,但是之前没有出现过这样的错误。
谢谢
我忘了在这个方法中调用函数git_libgit2_init()
和git_libgit2_shutdown()
。我在以前的方法中调用了它,我认为我也不必在那里这样做。