2

I'm trying to create a build pipeline in azure devops for .net core app with code from other git repository and providing user name and password. But I ended up with below error. Help me out

fatal: Authentication failed for git url 
##[error]Git fetch failed with exit code: 128
                                                                                               

Attached the error for the reference along with pipeline configuration enter image description here

enter image description here enter image description here

nagaraja
  • 51
  • 1
  • 1
  • 11
  • "Authentication failed for git url" looks pretty clear to me, you're providing incorrect credentials. – CodeCaster Jul 21 '20 at 09:33
  • I have provided correct credentials – nagaraja Jul 21 '20 at 10:07
  • There is something wrong with the credentials. Perhaps some characters in your login/password that requires url encoding? Were you able to test this commands elsewhere and it is working? Is the build agent a VM where you could log into and try the commands? – Philippe Jul 21 '20 at 11:02
  • How about the issue? Does the answer below resolved your question, If not, would you please let me know the latest information about this issue? – Leo Liu Jul 22 '20 at 09:20
  • 1
    Actually the is resolved as I had given wrong Git url in the service connection – nagaraja Jul 22 '20 at 18:08
  • from time to time I see this exact error in azure pipelines which ran OK yesterday ... same pipeline often runs OK once its relaunched ... sporadic is hard to fix ... challenge with massively distributed systems like azure pipelines where not all referenced code/binaries are local to the execution frame of reference ... in comparison I have never seen this issue on fully local VPS system ... azure still has teething pains for sure – Scott Stensland Nov 30 '21 at 21:17

3 Answers3

1

Disclamer: There is not enough information in your question to know if this advice apply. It only apply if you want to fetch from another Azure DevOps repository.

If you need to fetch from another Azure DevOps repository, you will have to set an header:

git -c http.extraheader="AUTHORIZATION: bearer %YOUR_TOKEN%" fetch --tags --prune --progress --no-recurse-submodules origin

If you want to fetch lfs file:

git -c http.https://taliance.visualstudio.com.extraheader="AUTHORIZATION: bearer %YOUR_TOKEN%" lfs fetch origin %Build_SourceVersion%

Note: %YOUR_TOKEN% could be replaces by %System_AccessToken% if you want to fetch from a git repository inside the same Azure DevOps project.

You could find more information in this answer: https://stackoverflow.com/a/53182981/717372

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • Im trying to create the build pipeline using other git repository outside azure git. Im not opting for azure git. – nagaraja Jul 21 '20 at 10:34
1

It might be an old post, but as I was struggling with that one for (way too) long time I can provide you what helped me:

There happened to be (another?) extraheader in my global configuration settings which seemed to be obsolete or false. So I unset this variable which resolved the issue.

/usr/bin/git config --global --unset http.extraheader

You can check your settings beforehand using:

git config --global --list
Nico
  • 151
  • 5
0

Azure DevOps error 'Git fetch failed with exit code 128' during build pipeline of other git Repository

According to the error message, fatal: Authentication failed for git url . This is indeed a issue from credentials.

When we create the service connections for the other git, there is no Verify option provided here, so we could sure whether the certification or service connection we provide are correct.

First, we need make sure we have checked the checkbox Grant access permission to all pipelines when we create the service connection:

enter image description here

Second, we need to verify the Username and Password/Token are correct. Since there is no such verify option, we could use git clone command with Username and Password/Token in the command line task:

git clone https://username:password@xxx.org/username/repository.git

Or

git clone https://PAT@xxx.org/username/repository.git

You could check this thread for some more details.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135