There is a related question on SO dealing with how to change the parameters of the push
command to avoid this message:
fatal: The upstream branch of your current branch does not match the name of your current branch
I'm interested in how to squelch the message itself, without changing the names of my local/remote branches or using fancy push
commands.
Suppose I have a local branch tracking a remote branch of a different name:
user@home:~ git branch -vv
branch-name abcd1234 [remote/origin/branch-name] last commit message
Now I want to be able to push my commited changes by simply typing git push
. When I do this, I get the following message:
fatal: The upstream branch of your current branch does not match the name of your current branch. To push to the upstream branch on the remote, use git push origin HEAD:remote/origin/branch-name To push to the branch of the same name on the remote, use git push origin branch-name
How do I force git
to automatically push to the upstream branch even if the names don't match? I'm using git 1.9.1
Newer Git (v 1.9 or newer)
git config --global push.default upstream
Older Git
git config --global push.default tracking
Git 2.3 still accepts tracking
as a synonym for upstream
Just do that once and whenever you "git push" it will push your current branch to its configured upstream.
This also sets it in your global config, which might be shadowed by a different setting in your repository config.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With