Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change destination of git push

Tags:

git

I have to remote repositories

$ git remote show

repoA
origin

git push will push changes to origin, how can I change the push destination so that it goes to repoA's url? I know I could use git push repoA branch but I want to just push to repoA master for now.

like image 911
el_pup_le Avatar asked Sep 15 '25 16:09

el_pup_le


1 Answers

If you want to push just for now, you can run this command:

git push <REMOTENAME> <BRANCHNAME> 

If your remote branch has different name than your local branch, you can run like this:

git push <remote-name> <local-name:remote-name>

If you want to set as default upstream git push behavior you can do like this:

git push -u <remote name> <local name>

or checkout to local branch and run:

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

and every time you run git push and gonna push to the repository you set

To validate the branch is setup with the correct upstream remote:

git branch -vv
like image 85
Ebrahim Poursadeqi Avatar answered Sep 18 '25 10:09

Ebrahim Poursadeqi