Fix Github server reference.

Take away the hardcoded URL of GitHub public server, given it is different for GitHub Enterprise editions. That also removed the usage of one of the variables. Check individual commits to see the main change.

Also strip it of trailing spaces and format code a bit better.