Push to multiple remote repos from a single local repo

amdadulhaque

Amdadul Haque

Posted on November 20, 2024

Push to multiple remote repos from a single local repo

Are you working on a front-end project for clients? The client set up a github repository and you need to push the code in that repo. Do you want to see a preview of how it looks on the live site? Here is a solution where you can set up another repo in your personal github account and host it for free in vercel or netlify.

Add remote repo

We know that we use

git remote add origin <url_to_our_github_repo>
Enter fullscreen mode Exit fullscreen mode

here the origin word is kind of a key and name to keep in mind for the github repo we have added.

So we can add another remote repo and then we need to select another name for that remote repo, lets have we choose a name dev so the command will be

git remote add dev <url_to_another_github_repo>
Enter fullscreen mode Exit fullscreen mode

Push

For pushing to remote repo (origin)

git push origin main
Enter fullscreen mode Exit fullscreen mode

dev repo

git push dev main
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
amdadulhaque
Amdadul Haque

Posted on November 20, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related