git-http-push - Linux
Overview
git-http-push pushes commits from a local repository to a remote repository exposed over an HTTP connection. It is useful for transferring commits to remote servers that do not support SSH or other protocols.
Syntax
git http-push [-q | --quiet] [-v | --verbose] [-p | --progress]
[-n | --dry-run] [-f | --force]
[-t | --tags] [--no-tags]
[<base-url>] <branch>:<remote-branch>
Options/Flags
-q
,--quiet
: Suppress progress output.-v
,--verbose
: Show verbose progress output.-p
,--progress
: Show progress updates during the push.-n
,--dry-run
: Do a dry run without actually pushing commits.-f
,--force
: Force the push even if the remote branch already exists and has diverged from the local branch.-t
,--tags
: Push tags along with the commits.--no-tags
: Do not push tags.
Examples
Push a single branch:
git http-push https://example.com/repo.git main:refs/heads/main
Push all branches:
git http-push https://example.com/repo.git refs/heads/*:refs/heads/*
Force push a branch:
git http-push -f https://example.com/repo.git main:refs/heads/main
Dry run:
git http-push --dry-run https://example.com/repo.git main:refs/heads/main
Common Issues
- Permission denied: Ensure you have sufficient write permissions to the remote repository.
- Remote repository not found: Verify that the specified base URL is correct and the remote repository exists.
- Diverging branches: If you encounter a merge conflict due to the remote branch having diverged, you can use
-f
to force the push, or try rebasing your local changes onto the remote branch.
Integration
With GitLab CI:
image: docker:latest
push:
stage: deploy
script:
- git fetch --unshallow
- git http-push $CI_SERVER_HTTP_URL $CI_PROJECT_PATH:$CI_COMMIT_REF_NAME
Related Commands
git push
: Similar command that uses SSH by default.git clone
: Creates a new local repository by copying contents from a remote repository.