Fix a bug in git remote + refactorings.

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>