michf
michf

Reputation: 239

GIT (TFS) error: Authentication failed on HTTPS push

For several days I've been fighting the problem of git authentication (TFS). I use VSTS (git from TFS) and Jenkins. I`ve set proper credentials in jenkins git plugin. The project is successfully cloned during the build, but after push (with the same credentials) I get:

fatal: Authentication failed for (url of team project) 

I`ve also tried push commit from pipeline (without jenkins credentials manager):

https://username:[email protected]/xxxxx/_git/xxxx

and with Personal Access Token:

https://username:[email protected]/xxxxx/_git/xxxx

Unfortunately I also got Authentication failed error.

I checked locally using git bash - cloning and pushing with default git URL (https://username:password.xxxxx.com/xxxxx/_git/xxxx) working fine - but when I set remote to:

git remote set origin
     https://username:[email protected]/xxxxx/_git/xxxx

and then I push to

git push https://username:[email protected]/xxxxx/_git/xxxx

I get Authentication failed error again.

I have no idea how to fix pushing from Jenkins build. I had two ideas (Jenkins credential manager or authentication by username: password in URL). Unfortunately I can't use SSH.

Has anyone encountered such a problem in the Microsoft product (Vsts git)?

Upvotes: 1

Views: 946

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51103

To narrow down if the issue related to Azure DevOps server/TFS side or Jenkins, you should first try to make git command works properly with git remote, through git bash.

Did you first git remote add repourl. Take a look at this link: Visual Studio Clone from Github & push to VSTS

Besides, since you are using Git with TFS, check if you already turned off Basic Authentication.

We recommend you keep IIS Basic Authentication turned off at all times when using Azure DevOps Server. Only if necessary should you enable IIS Basic Authentication. When IIS Basic Authentication is enabled on your windows machine, it prevents you from using personal access tokens (PATs) as an authentication mechanism.

If you use Git with IIS Basic Authentication, Git will break because **it requires PATs for user authentication.

More details please take a look at this official link.

Upvotes: 0

Related Questions