summaryrefslogtreecommitdiffstats
path: root/examples/push.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 05:03:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 05:03:04 +0000
commitb88736462df2c86a83f01dcc260b5463205819d2 (patch)
treeb1a9a5a5392a52ec4e5f60fb4b45083cf7fd65b0 /examples/push.c
parentAdding upstream version 1.7.2+ds. (diff)
downloadlibgit2-b88736462df2c86a83f01dcc260b5463205819d2.tar.xz
libgit2-b88736462df2c86a83f01dcc260b5463205819d2.zip
Adding upstream version 1.8.1+ds.upstream/1.8.1+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--examples/push.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/push.c b/examples/push.c
index bcf3076..5113eed 100644
--- a/examples/push.c
+++ b/examples/push.c
@@ -32,6 +32,7 @@
/** Entry point for this command */
int lg2_push(git_repository *repo, int argc, char **argv) {
git_push_options options;
+ git_remote_callbacks callbacks;
git_remote* remote = NULL;
char *refspec = "refs/heads/master";
const git_strarray refspecs = {
@@ -47,7 +48,11 @@ int lg2_push(git_repository *repo, int argc, char **argv) {
check_lg2(git_remote_lookup(&remote, repo, "origin" ), "Unable to lookup remote", NULL);
+ check_lg2(git_remote_init_callbacks(&callbacks, GIT_REMOTE_CALLBACKS_VERSION), "Error initializing remote callbacks", NULL);
+ callbacks.credentials = cred_acquire_cb;
+
check_lg2(git_push_options_init(&options, GIT_PUSH_OPTIONS_VERSION ), "Error initializing push", NULL);
+ options.callbacks = callbacks;
check_lg2(git_remote_push(remote, &refspecs, &options), "Error pushing", NULL);