Git sync fails with "too many redirects or authentication replays"

Product: PowerShell Universal
Version: 2.6.0

We’re not able to get the Git sync to work yet and are seeing the following error in the notifications list:

Git Synchronization Failed
too many redirects or authentication replays

We are using a personal access token (pat) created in Bitbucket and tested the pat from the command line to clone the empty repo we set up for PSU. We also checked that the branch name was correct in app config settings.

Logs show:

[ERR] Failed to sync: too many redirects or authentication replays at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
at UniversalAutomation.Git.GitService.Initialize() in D:\a\universal\universal\src\Universal.Server\Services\GitService.cs:line 140
at UniversalAutomation.GitSyncService.TrySync() in D:\a\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 119
at UniversalAutomation.GitSyncService.Sync() in D:\a\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 70

Appreciate any suggestions on troubleshooting steps.

Thank you for your help.

We resolved this issue for Bitbucket by specifying an existing Bitbucket username for the GitUserName property in addition to the personal access token in the appsettings.json file. It seems like any username works for Github, but Bitbucket needs the username apparently. However, interacting with Bitbucket from the command line did not need the username.

2 Likes

I’ll add a note to the docs about this. Thanks for circling back.

2 Likes

Had this crop up myself on Friday after redeploying my app services - seem to have got it working again by redeploying with the sync set to one-way so it let whatever is in the repo win any merge conflicts.

Have now reset to two-way and it seems to still be behaving.