Git sync failing - too many redirects or authentication replays
Product: PowerShell Universal Version: 2.10.2
Recenlty reconnected our Gitlab repo back up as a PushOnly connection. It showed a successful sync for changes made since it was disconnected, but now it fails every minute and throws this error in the logs
2022-05-02 23:59:18.948 -04:00 [ERR] Failed to sync: too many redirects or authentication replays at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154 at LibGit2Sharp.Core.Proxy.git_remote_push(RemoteHandle remote, IEnumerable`1 refSpecs, GitPushOptions opts) in /_/LibGit2Sharp/Core/Proxy.cs:line 2253 at LibGit2Sharp.Network.Push(Remote remote, IEnumerable`1 pushRefSpecs, PushOptions pushOptions) in /_/LibGit2Sharp/Network.cs:line 381 at LibGit2Sharp.Network.Push(IEnumerable`1 branches, PushOptions pushOptions) in /_/LibGit2Sharp/Network.cs:line 240 at UniversalAutomation.Git.GitService.Push() in D:\a\universal\universal\src\Universal.Server\Services\GitService.cs:line 306 at UniversalAutomation.GitSyncService.TrySync() in D:\a\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 178 at UniversalAutomation.GitSyncService.Sync() in D:\a\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 102
Here is the config in the json
Our git server doesn’t have any redirects that I know of. Just a basic GitLab instance with LDAP auth.
d47554e0914c4d2739f8f67d0a9821d97d1c910a.png
This error is a bit misleading. It typically means something is wrong with the credentials.
Forums – 22 Mar 19
There is an outstanding issue on the lib2gitsharp repo about this. Some mention that reverting to an older version worked for them. PSU is using the latest version: 0.27.0-preview-0182.
github.com/libgit2/libgit2sharp
Adam Driscoll
PowerShell Expert and Developer at Devolutions
I just verified the credentials work correctly in the webUI for GitLab (copied and paste the username and password directly from the appsetttings.json).
I removed the dedicated Universal Credentials for Git and used my account and still get the same error.
Ok. I’ll open an issue for this. Others have definitely seen this problem.
Adam Driscoll
PowerShell Expert and Developer at Devolutions
@AnonymousUser - I’ve added some additional info to the GitHub issue: Git Sync - Too Many Redirects · Issue #1160 · ironmansoftware/issues · GitHub
Can you please try the git remote format I suggested?
Adam Driscoll
PowerShell Expert and Developer at Devolutions
I’ll respond on the issue.
Just had this issue as well with Github, I tried all the above with no luck. I ended up needing to nuke the local repo and generate a new Github token then re-sync everything with PSU.
Seems to be working as expected after that.