Cloud storage: use our credentials when updating the remote

If we are pushing to an ssh or https based remote we need to use our
credentials.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-10 21:55:19 -07:00
parent 26cbc32495
commit 8ad000846d

View file

@ -134,6 +134,12 @@ static int update_remote(git_repository *repo, git_remote *origin, git_reference
refspec.count = 1;
refspec.strings = (char **)&name;
#if USE_LIBGIT23_API
if (rt == SSH)
opts.callbacks.credentials = credential_ssh_cb;
else if (rt == HTTPS)
opts.callbacks.credentials = credential_https_cb;
#endif
if (git_remote_push(origin, &refspec, &opts))
return report_error("Unable to update remote with current local cache state (%s)", giterr_last()->message);