I'm currently using git on windows through a combination of msysgit and Cygwin.
I have a laptop which I move around quite a bit, so it's not on a consistent location. Unfortunately, I don't have a consistent name for it due to the computer name not being resolved on all of the locations I connect to, so I can't just use the computer name as the host for the url (e.g. git://compname/repo), so I have to use the IP address.
Is there a way I can add multiple urls to pull from for a particular remote? I've seen
git remote set-url --add [--push] <name> <newurl>
as a way to add multiple URLs to a remote, and I can see the updates in the .git/config file, but git only tries to use the first one.
Is there a way to get git to try to use all of the urls? I've tried both git fetch and git remote update, but neither tries anything after the first url.
Note that I haven't tried this on linux yet, and I can't fix the computer name resolution as this is at work.
I think your best best is to set your remote URI to point to computername but then add computername to your hosts file (located at %SystemRoot%\system32\drivers\etc\hosts
):
computername 192.168.100.34
# computername 192.168.100.68
Then you can keep multiple entries for the different IP addresses and comment / uncomment them as needed. No more messing about changing the remote URI on a per-repo basis, just update in one place and then all repos using computername as the URI will use the new location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With