3
votes

I am trying to create a TFS build which pulls sources from a Gitlab repo. Both are on-premise servers.

When running the build (manually), I get the following error:

LibGit2Sharp.LibGit2SharpException: Too many redirects or authentication replays

This is my Get Task:

Get Task

And this is the service endpoint definition:

Service Endpoint

I have tried using my password and also a Personal Access Token created in Gitlab. Same error in both cases.

Any ideas?

Thank You, Shay

Update: I've updated the TFS agent and stopped getting the above error. I now get the following:


Starting: Get Sources


Syncing repository: http://gitlab/SoftwareGuildTaksforce/SoftwareGuildServer.git (Git) Prepending Path environment variable with directory containing 'git.exe'.

git version git version 2.12.0.windows.1

git config --get remote.origin.url

git config gc.auto 0

git config --get-all http.http://gitlab/.extraheader

git config --get-all http.proxy

git remote set-url origin http://********:********@gitlab/

git remote set-url --push origin http://********:********@gitlab/

git fetch --tags --prune --progress origin fatal: unable to update url base from redirection: asked for: http://********:********@gitlab/info/refs?service=git-upload-pack redirect: http://gitlab/users/sign_in

Git fetch failed with exit code: 128


The Gitlab server does not support https, so that is not an option. I also tried adding my username/password to the Gitlab URL, both on the endpoint definition and on the Get Task repository. That did not help.

2
Hi shayc, any update on this issue?PatrickLu-MSFT

2 Answers

1
votes

Instead of using http on the "Services" endpoint you created on TFS for accessing your GitLab repository, please use HTTPS in the URL instead.

Besides to enable HTTPS access to your repository, remember to set a password on your GitLab account, then use that password along with your username (email address) on the "Services" endpoint set up on TFS.

Then try to trigger the build and test again.

0
votes

I finally got it to work. I created a Personal Access Token in Gitlab and added it to the repository URL in the build definition (both in the Get Task and in the Service Endpoint Definition). It is now able to clone the repo and build.