Git sees double
This post is an automatic translation from French. You can read the original version here.
Hello folks!
A quick note-taking session, because I know I’ll forget everything if I don’t write it down :)
Since I started streaming, I often need two remotes on my git repositories: a public remote, typically GitHub or GitLab, and a private remote. The problem with this approach is that I have to type “git push” twice: once for each of my remotes. It’s a waste of time, a risk of forgetting … In short, Rancune is not happy!
It turns out there’s another solution: give two push addresses to the same remote. It’s not very complicated, you just need to do:
git remote set-url --add --push origin <address of repo 1>
git remote set-url --add --push origin <address of repo 2>And there you go! The “origin” remote now has two push addresses. For example, for one of my projects, it looks like this:
+ git remote -v
origin seb@coffee:./git/devel_hw/GenericLib.git (fetch)
origin git@github.com:Rancunefr/GenericLib.git (push)
origin seb@coffee:./git/devel_hw/GenericLib.git (push)When you push, it will now automatically be done twice.
Rancune.