diff --git a/gwinc/test/__main__.py b/gwinc/test/__main__.py
index cfe52ed962c45bf6d7737f79b8ecb02bb0a4ff0a..092d0c6017cd5716793b13147731abb1a9da556c 100644
--- a/gwinc/test/__main__.py
+++ b/gwinc/test/__main__.py
@@ -44,7 +44,7 @@ def git_find_upstream_name():
         ).stdout
     except subprocess.CalledProcessError as e:
         logging.error(e.stderr.split('\n')[0])
-    for remote in remotes.split('\n'):
+    for remote in remotes.strip().split('\n'):
         name, url, fp = remote.split()
         if 'gwinc/pygwinc.git' in url:
             return name