Skip to content
Latchkey

Git "warning: redirecting to https://..." in CI

The host answered your request with a redirect to a different URL - usually http:// to https://, or a normalized path. The clone may still work, but the redirect can drop credentials or break a push, so the warning is worth fixing at the source.

What this error means

Git prints warning: redirecting to https://github.com/org/repo.git/ during a fetch or push. A fetch may succeed, but a push sometimes fails afterward because the credential was not carried across the redirect.

git output
warning: redirecting to https://github.com/org/repo.git/
# a later push may then fail:
fatal: Authentication failed for 'http://github.com/org/repo.git/'

Common causes

Remote configured with http:// or a non-canonical path

An http:// remote (or one missing the trailing .git) is 301-redirected by the host to the canonical https://...git/. Git follows it but warns.

Credentials not reused across the redirect

Git does not always replay credentials on a redirected request, so a write that needs auth can fail even though the read redirect succeeded.

How to fix it

Point the remote at the canonical HTTPS URL

Set the remote to the final https:// form so no redirect happens.

Terminal
git remote set-url origin https://github.com/org/repo.git
git remote -v

Allow credential reuse on redirect if you must redirect

When you cannot change the URL, let Git replay credentials across the redirect.

Terminal
git config --global http.followRedirects true
git -c credential.helper= -c http.followRedirects=true push origin main

How to prevent it

  • Always configure remotes with the canonical https://host/org/repo.git URL.
  • Avoid http:// remotes in CI entirely.
  • Keep the trailing .git so the host does not normalize the path.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →