Changing the Git remote 'push to' default

Solution 1:

You can use git push -u <remote_name> <local_branch_name> to set the default upstream. See the documentation for git push for more details.

Solution 2:

To change which upstream remote is "wired" to your branch, use the git branch command with the upstream configuration flag.

Ensure the remote exists first:

git remote -vv

Set the preferred remote for the current (checked out) branch:

git branch --set-upstream-to <remote-name>

Validate the branch is setup with the correct upstream remote:

git branch -vv

Solution 3:

Working with Git 2.3.2 ...

git branch --set-upstream-to myfork/master

Now status, push and pull are pointed to myfork remote

Solution 4:

You can easily change default remote for branches all at once simply using this command

git push -u <remote_name> --all