• Hello, Visitor
  • Monday, February 17, 2025
Search Result
Home » More » GitHub » Push your project in multiple git repositories at a time

Push your project in multiple git repositories at a time

Hello friends, today in this blog you’ll learn how to push a project in multiple git repositories at a time in one git push command.

Pushing a project in multiple repositories means, suppose you have a project to work with, but this project needs to upload to your client's git repository. But at the same time, you want to upload the project with commits in your git profile too. And you can push a project in multiple repositories by following this post.

Video Tutorial:



Step 01: Create two repositories

Create two repositories in two different accounts and add a collaborator for a git repository that you want to use as a second repository to push the project.


Step 02: Push your project

Now push your project into one of your repositories by using the following commands

git init
git add .
git commit -m "First commit"
git branch -M main
git remote add origin <YOUR REPOSITORY HTTPS URL>
git push -u origin main

Now, you can see the updates in your repository.


Step 03: Add your 2nd repository

Now add your second repository as a push origin by following the command,

git remote set-url --add --push origin <YOUR 2ND REPOSITORY HTTPS URL>

Now you can see your second repository as a push URL by using the following command

git remote -v


So, again add the first repository URL with the following command

git remote set-url --add --push origin <YOUR 1ST REPOSITORY HTTPS URL>

Now you can see your both repository as a push URL by the following command again

git remote -v



Step 04: Push the project again

Now push your project with the following commands

git add .
git commit -m "Changes"
git push

It will push your project into both repositories.

Hope it will help you.

Thanks for reading


Leave a Reply

You must Login to add a comment