Git Push Branch to GitHub
Push Branch to GitHub
This chapter explains how to push a branch from your local computer to GitHub.
Push a Branch to GitHub
Let's create a new local branch, make a change, and push it to GitHub.
Edit a file, then check the status:
Example
git status
On branch update-readme
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
Try it Yourself »
Add and commit your changes:
Push your branch to GitHub:

Push and Set Upstream
Use this if your branch doesn't exist on GitHub yet, and you want to track it:
Force Push
Warning: This overwrites the branch on GitHub with your local changes. Only use if you understand the risks.
Delete Remote Branch
Remove a branch from GitHub:
Push All Branches
Push all your local branches to GitHub:
Push Tags
Push all your tags to GitHub:
Troubleshooting
- Rejected push (non-fast-forward): Someone else pushed changes before you. Run
git pull --rebasefirst, then try again. - Authentication failed: Make sure you are logged in and have permission to push to the repository.
- Remote branch not found: Double-check the branch name and spelling.