Fix repo credentials when no credentials in url

Credentials were being overwritten with nil when there was no username or
password in the repository url.  Fixes regression introduced in
a61d6a66a6b2a68b9b6761ac98509703b374532b.
Merge pull request #1046 from hugoduncan/feature/fix-repo-credentials

Fix repo credentials when no credentials in url