First of all, when pushing for the first time, do:
git push -u origin hp1:team/hp1
About -u option:
-u
–set-upstreamFor every branch that is up to date or successfully pushed, add
upstream (tracking) reference, used by argument-less git-pull(1) and
other commands. For more information, see branch..merge in
git-config(1).
Note from the manual that, this in itself will not determine what happens when you do git push
the next time. When you do git pull
while in this branch, it will fetch it from the upstream that you have set. But when you push, it will push to a matching branch ( in this case hp1 and not team/hp1)
For that to work, you have to set push.default
config value to upstream
. Once you set that, when you push from a branch ( just do git push
), it will push to the upstream as mentioned by branch.<name>.merge
So do:
git config push.default upstream
About push.default:
push.default
Defines the action git push should take if no refspec is given on the
command line, no refspec is configured in the remote, and no refspec
is implied by any of the options given on the command line. Possible
values are:nothing – do not push anything.
matching – push all matching branches. All branches having the same
name in both ends are considered to be matching. This is the default.upstream – push the current branch to its upstream branch.
tracking – deprecated synonym for upstream.
current – push the current branch to a branch of the same name.