diff --git a/salt/modules/git.py b/salt/modules/git.py index 3b825d2d2f1d..ccdf8f3eae7c 100644 --- a/salt/modules/git.py +++ b/salt/modules/git.py @@ -817,7 +817,7 @@ def remote_set(cwd, name='origin', url=None, user=None, https_user=None, https_only=True) except ValueError as exc: raise SaltInvocationError(exc.__str__()) - cmd = 'git remote add {0} {1}'.format(name, url) + cmd = 'git remote add {0} \'{1}\''.format(name, url) _git_run(cmd, cwd=cwd, runas=user) return remote_get(cwd=cwd, remote=name, user=None) diff --git a/salt/states/git.py b/salt/states/git.py index 14b6688c7606..a554b57ede59 100644 --- a/salt/states/git.py +++ b/salt/states/git.py @@ -264,12 +264,15 @@ def latest(name, if remote is None or remote[0] != desired_fetch_url: __salt__['git.remote_set'](target, name=remote_name, - url=desired_fetch_url, + url=name, user=user, https_user=https_user, https_pass=https_pass) ret['changes']['remote/{0}'.format(remote_name)] = ( - "{0} => {1}".format(str(remote), redacted_fetch_url) + "{0} => {1}".format( + salt.utils.url.redact_http_basic_auth(str(remote)), + redacted_fetch_url + ) ) # Set to fetch later since we just added the remote and # need to get the refs