Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure git to pull from one repository and push to another

Tags:

git

I have two remote repositories: a main repository and a fork, and want to pull new changes from the main repo and push to my fork so I can create pull-requests to the main repo.

I know it is posible to add both remotes using git remote add <name> <url> but I don't want to explicitly do git pull <main_repo> and git push <fork_repo>

like image 780
Fabian Mendez Avatar asked Sep 10 '25 09:09

Fabian Mendez


1 Answers

git remote set-url --push origin <fork_repo>

After doing that you can check urls with this command

git remote -v

and you'll see something like

origin <main_repo> (fetch)
origin <fork_repo> (push) 
like image 81
Guillermo Mansilla Avatar answered Sep 13 '25 00:09

Guillermo Mansilla