nagaraja
nagaraja

Reputation: 51

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

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

Upvotes: 2

Views: 33550

Answers (5)

LGsus
LGsus

Reputation: 1

If you are using a self-hosted agent, just run the PowerShell as administrator, most likely you need administrator privileges to make changes into the folder

Upvotes: 0

Sud
Sud

Reputation: 306

I had same issue. Re-Installing GIT on the Azure Virtual machine solved this problem.

Upvotes: 0

Nico
Nico

Reputation: 151

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

Upvotes: 1

Leo Liu
Leo Liu

Reputation: 76948

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:[email protected]/username/repository.git

Or

git clone https://[email protected]/username/repository.git

You could check this thread for some more details.

Upvotes: 0

Philippe
Philippe

Reputation: 31227

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

Upvotes: 1

Related Questions