Detect the current environment without using the upstream.

Developers should have the freedom to set other upstreams on their Git branches.

Plus, there are other bugs e.g. issue #109 which mean that the upstream is not set properly.

I haven't tested this as I'm on a train without enough connectivity.