If you are using a laptop, and moving it around, so you need to use different repos from different locations, I would suggest to implement switching logic based on the localhost IP subnet or hostname (keep in mind that hostname takes a bit to resolve and it will be done during each build).
If you have the same codebase checked out from different machines and each machine needs different repo, then it will be simpler to specify the repo URL in
~/.gradle/gradle.properties and make sure that each machine is set up to point to the right repo. This requires a one-time extra step, but gives you the flexibility to onboard new locations without touching the build.
~/.gradle/init.gradle you may completely rewrite whatever repos the
build.gradle file specified (hint: the
repositories domain object is a collection, mutable during hte config phase). The management aspect is similar to the
~/.gradle/gradle.properties solution, but it allows you to run any external build without modification.