Pushing
Pushing branches to GitHub with Claude Code, standalone git push, how it fits with commit workflows, and permission expectations.
Pushing sends your local commits to the remote (usually origin) so teammates and GitHub can see them. Claude Code does this through the same Bash / git execution model as any other command: the model or a slash command runs git push (with appropriate refspec) when you ask.
When you push in agent workflows
-
Manual / chat: Ask explicitly: push my current branch to origin or push and set upstream. The agent needs permission to run
git push(and network access, depending on your host). -
Bundled with review flow: The
/commit-push-prcommand (Commit Commands plugin) commits, pushes, and creates a PR in one flow, the push step is part of that pipeline. See Opening pull requests for the full story. -
After one or more
/commitruns: You are on a feature branch with local commits; pushing publishes that branch so opening a PR or reviewing can happen on GitHub.
GitHub CLI and gh
Pushing is plain Git; the GitHub CLI (gh) is not required to push (only to gh pr create, gh pr view, etc.). Ensure git remote and credentials (SSH key, HTTPS token, or gh auth-backed helper) are set up outside the model, Claude Code does not replace your OS keychain.
Permissions and protected branches
-
git pushmay be ask or deny in your Claude Code policy, especially for--force, which upstream examples often block for safety. Match your org’s branch protection; if the remote rejects a push, fix branch name / permissions / rules on GitHub first. -
For a broader take on what the agent is allowed to run, see Permissions and Secure execution.
Next: Opening pull requests, from a pushed branch to a PR. Or Reviewing pull requests if you are on the receiving side.
Sources: Commit Commands README, /commit-push-pr and feature-branch examples.
Committing code
How Claude Code helps you create git commits with the Commit Commands plugin, what /commit does, and how it stays aligned with your repo and safety rules.
Opening pull requests
Creating GitHub pull requests from Claude Code using the GitHub CLI and the /commit-push-pr workflow, auth, branch handling, and PR bodies.