0

I am trying to clone a git repo using libgit2 but the following code is throwing error even though it is taken from examples .

int do_clone(git_repository *repo, string url, string path) {
    progress_data pd = {{0}};
    git_repository *cloned_repo = NULL;
    git_clone_options clone_opts = GIT_CLONE_OPTIONS_INIT;
    git_checkout_opts checkout_opts = GIT_CHECKOUT_OPTS_INIT;
    int error;
    (void) repo;
    checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
    checkout_opts.progress_cb = checkout_progress;
    checkout_opts.progress_payload = &pd;
    clone_opts.checkout_opts = checkout_opts;
    clone_opts.fetch_progress_cb = &fetch_progress;
    clone_opts.fetch_progress_payload = &pd;
    error = git_clone(&cloned_repo, url.c_str(), path.c_str(), &clone_opts);
    printf("\n");
    if (error != 0) {
        const git_error *err = giterr_last();
        if (err) printf("ERROR %s\n", err->message);
        else printf("ERROR %d: no detailed info\n", error);
    } else if (cloned_repo) git_repository_free(cloned_repo);
    return error;
}

Following is the error :

ERROR HTTP parser error: invalid constant string

Any helping directions ?

simonc
  • 41,632
  • 12
  • 85
  • 103
Captain Barbossa
  • 1,067
  • 10
  • 16

0 Answers0