xx
.md

git_push

git_push pushes refs from an existing project-relative Git repository. It returns a dependency. When refspecs is omitted, current branch is pushed to same branch name. Detached HEAD requires explicit refspecs unless tags=True, which pushes tags without a branch. Set tags=True to push all local tags. Already-up-to-date pushes succeed.

Host access and credential limitations match git_clone.

go-git exposes configured url and pushurl values as one ordered list. git_push uses final configured URL, matching go-git's push behavior. Remotes requiring pushes to multiple URLs are not supported.

Arguments

ArgumentRequiredDescription
repositoryNoProject-relative Git repository directory. Defaults to ..
remoteNoConfigured remote name. Defaults to origin.
refspecsNoPush refspec strings in fully qualified source:destination form, such as refs/heads/main:refs/heads/main. Defaults to current branch only.
tagsNoPush all local tags in addition to selected non-tag refs. Cannot be combined with refspecs targeting tags. Defaults to False.
forceNoPermit non-fast-forward updates. Defaults to False.
depsNoDependencies to complete before pushing.

Example

load("@git@1", "git_commit", "git_push")

commit = git_commit(
    repository=".xx/output",
    message="Update generated files",
    deps=[generate],
)

git_push(
    repository=".xx/output",
    tags=True,
    deps=[commit],
)