Post

Setup Git push to multiple URLs with same origin

Setup Git push to multiple URLs with same origin

To push changes to multiple origins, you need to configure multiple push URLs.

How to add multiple URLs

To check current origin using this command:

1
git remote show origin

You will see Fetch and Push URL, you can add new push destination like this example

1
2
3
git remote set-url --add --push origin https://github.com/your-group/your-repo.git
# if want to add another one, here is an example
git remote set-url --add --push origin https://gitlab.com/your-group/your-repo.git

You can use multiple URLs only for Push. Fetch need to specified only one URL

This post is licensed under CC BY 4.0 by the author.