Correct detection of remote repository name to not delete CWD in case of failures (#99)
(cherry picked from commit f50a9f808fe54ee2996fba9cb19f8deb486ee6ec)