Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
198a1b20
Unverified
Commit
198a1b20
authored
Dec 21, 2023
by
Edward Thomson
Committed by
GitHub
Dec 21, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5904 from pluehne/support-authentication-in-push-example
Support authentication in push example
parents
517d2cd3
7ed00c5c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
examples/push.c
+5
-0
No files found.
examples/push.c
View file @
198a1b20
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
/** Entry point for this command */
/** Entry point for this command */
int
lg2_push
(
git_repository
*
repo
,
int
argc
,
char
**
argv
)
{
int
lg2_push
(
git_repository
*
repo
,
int
argc
,
char
**
argv
)
{
git_push_options
options
;
git_push_options
options
;
git_remote_callbacks
callbacks
;
git_remote
*
remote
=
NULL
;
git_remote
*
remote
=
NULL
;
char
*
refspec
=
"refs/heads/master"
;
char
*
refspec
=
"refs/heads/master"
;
const
git_strarray
refspecs
=
{
const
git_strarray
refspecs
=
{
...
@@ -47,7 +48,11 @@ int lg2_push(git_repository *repo, int argc, char **argv) {
...
@@ -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_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
);
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
);
check_lg2
(
git_remote_push
(
remote
,
&
refspecs
,
&
options
),
"Error pushing"
,
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment