git push
git push
update remote refs along with associated objects
Steps: git add
-> git commit
-> git push
Basic commands
git push
git push -v
GIT_SSH_COMMAND="ssh -v" GIT_TRACE=1 git push -vvv -u origin main
GIT_SSH_COMMAND="ssh -v" GIT_TRACE=2 git push -vvv -u origin main
git push -v -u origin main
git push -v --force -u origin main
git push -f origin master
git push -u origin main
git push -uf
git push origin master
git push -u origin master
git push -u origin master or git push --set-upstream origin master (Used by argument-less
git pull
)
- git push origin HEAD:master
git push
Everything up-to-date
git push -u origin master Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 212 bytes | 212.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 To ssh://gitlab.yourdomain.com:2224/project/project_test.git * [new branch] master -> master Branch 'master' set up to track remote branch 'master' from 'origin'.
git push with errors
git push -u origin master ssh_exchange_identification: read: Operation timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
[rejected]
git push To github.com:user/proyect.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'github.com:user/proyect.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
No configured push destination
git push fatal: No configured push destination. Either specify the URL from the command-line or configure a remote repository using git remote add <name> <url> and then push using the remote name git push <name>
No upstream branch
git push fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin master
error: src refspec master does not match any
You are not allowed to force push code to a protected branch
Example with all steps
touch README.md git add README.md git commit -m "add README" git push -u origin master
Activities
Related terms
See also
git push
[-v
|--set-upstream | -o | --set-upstream origin master
|-u origin main
|origin master
|-u origin master
|--delete master
|-u | origin HEAD | --dry-run
], Git: upstream,git push --force
git
: [config | init | status ]
,git add
,git rm
,git commit
,git push, git pull
,.gitconfig
,.gitignore
,git
(clone
,fetch
,pull
),git tag
,git log
,git blame
, Merge Request, LFS,git branch
,git apply
,git rebase
,git diff
,git diff-tree
,git config --global
,remote | submodule | request-pull
,GIT_TRACE, GIT_CURL_VERBOSE
,clean
,main
,git show-ref
,git reset
,git prune
,git ls-remote origin
,git checkout
,git switch
,pathspec
,git credential-osxkeychain
,git version
,pre-commit
,git --help
, GitBook,refs/
Advertising: