If you create a local repository by:
git init
Then how to set a default remote for git push
so if you create a new branch and want to git push
its commits you don't need to specify the remote destination?
Take into account that the local repository is not cloned form a remote and just initialized so it does not have any commits to be pushed nor branches.
so far I only managed to set the remote for the master because it is the default name for the first branch but this does not solve the problem because other branches that will be created have at this point unknown names.
Is there any config entry you can use to set default push destination for branches in this case?
You can set
push.default
to current like this:It's described in
man git-config
:To check how it works in practice first add a remote repository you will push to after creating a new local repository, it can even reside on the same filesystem:
and then try
git push
- first withmaster
branch and then withdev
: