I am trying to set up a Git repo on a remote server of mine, that I am sharing with someone else. Only thing is, this is located in my LAN, which I am not always a part of.
I would like to be able to have 2 remotes using the same branch, all synchronized, almost like a symlink (but with configs).
To make things harder, if I try to use the external IP as a remote while in the LAN, it will fail, as that maps to my router's own internal IP.
I would like to be able to do
git push/pull lan
git push/pull wan
As I commented below, one can add to a local repo as many remotes as you need:
git remote add upstream1 /url/first/repo git remote add upstream2 /url/first/repo
git push can select the right remote to use:
git push upstream1 # or git push upstream2
The easiest would be add a script which would:
replace origin with the url that works in the current environment
git remote set-url origin /url/that/works
That way, you always have just one remote to manage: the default one called '
But each time you are switching environment, your script can update