-1

I have 2 remove repositories (origin1 and origin2 for example).

And origin1 is my default remote repo. How can I change my default remote repo, so when i do git push commits push to origin2.

Florian
  • 2,562
  • 5
  • 25
  • 35
SsPay
  • 177
  • 1
  • 10
  • 2
    Does this answer your question? [Changing the Git remote 'push to' default](https://stackoverflow.com/questions/18801147/changing-the-git-remote-push-to-default) – kapsiR Nov 09 '20 at 09:17
  • 2
    This element of config happens at branch level, not remote. – Romain Valeri Nov 09 '20 at 09:49

2 Answers2

3

You can change the remote repository your local branch is currently tracking

git branch local_branch_name --set-upstream-to origin2/remote_branch_name

or

git branch local_branch_name -u origin2/remote_branch_name

After this, your pull and push will be done on the new tracked remote.

Pat. ANDRIA
  • 2,330
  • 1
  • 13
  • 27
-1

Have you tried "git remote add" command? https://docs.github.com/en/free-pro-team@latest/github/using-git/adding-a-remote

codegorilla
  • 486
  • 3
  • 11