Add additional logging for importing course from git

We are running into issues with git raising permission denied errors or other issues that are hard to troubleshoot, so I'm adding exception logging of the command output on external commands.

I also added a test to see if I couldn't get coverage on the git branch command, but moving the repo into detached head state causes the pull to fail before the branch checking code is exercised.  I left the test and the exception code in there anyway.

Potential reviewers: @singingwolfboy @cpennington @nedbat
Heads up to @sarina