# Git push URLs for pushing your repository to multiple remotes

Today I learned about Git's "push URLs" thanks to A Superior Git Remote (opens new window).

Essentially, git allows you to add multiple "push URLs" for a remote via git remote set-url --push --add (opens new window). All push URLs will be pushed to when you push to that remote.

This is super useful for when you want to automatically back up your git repository to another provider.

For example, I have a notes repository which I want to back up to both Github and Gitlab. So I will add a push URL for both of them with:

git remote set-url --push --add origin [email protected]:delenamalan/notes.git
git remote set-url --push --add origin [email protected]:delenamalan/notes.git
1
2

And now when I run git push origin, my branch will be pushed to both Github and Gitlab.

I use gitwatch (opens new window) to automatically push any changes to my notes repository so that it's always backed-up.

Push URLs are not quite suitable for fully-fledged repository back-ups, but it's a very easy solution for small repositories that only have a few contributors.

Newsletter

If you'd like to subscribe to my blog, please enter your details below. You can unsubscribe at any time.

Powered by Buttondown.

Last Updated: 11/20/2023, 10:04:51 AM