0

I use TFS for source control and when I use git command line from new machine, I need to save credentials manager manually. Otherwise, I receive "Authentication Failed"

Is there alternative than pre-defining credentials in credential manager?

Current case from CentOS 7:

enter image description here

jww
  • 97,681
  • 90
  • 411
  • 885

1 Answers1

0

The Git Credential Manager which is just used to provide security Git credential storage. It's ok to pre-defining credentials in credential manager.

However for macOS and Linux, instead of using credential manager,

We recommend using SSH keys to authenticate to Azure DevOps, not a credential manager.

SSH public key authentication works with a pair of generated encryption keys. The public key is shared and used to encrypt messages. The private key is kept safe and secure on your system and is used to read messages encrypted with the public key.

More details please take a look at our official tutorial--Use SSH key authentication


Update

Besides, you could also use PAT token to access git repositories.

To authenticate with the PAT while using Git, you can use it as the password. The username can be anything, since your identity is identified with the PAT. For example:

  • Username: anything
  • Password:

Or:

git clone https://anything:<PAT>@dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName

More details please take a look at this link.

As for how to use PAT, you could refer this -- Authenticate access with personal access tokens

Note: This is only available with TFS2017 version and above. Besides, recommend you keep IIS Basic Authentication turned off when using Azure DevOps Server. When IIS Basic Authentication is enabled on your windows machine, it prevents you from using personal access tokens (PATs) as an authentication mechanism.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • I used ssh as a workaround this issued when it was raised. However, when TFS trigger service hooks for code change, it triggeers with (https) callback not ssh. – abdulrhman alhazmi Nov 24 '19 at 10:41
  • My scinario is that i 1- defined my repository in Jenkins pipline to clone using ssh. 2- when code is push to TFS, there is a service hooks in TFS that notifies Jenkins syaing "code is pushed, use this URL to clone", but the URL is https not ssh. so jenkins fails to do so because credintials are not defined for https. I do not want to dive into modifiying TFS to use ssh callback instead of https. – abdulrhman alhazmi Nov 24 '19 at 10:43
  • @abdulrhmanalhazmi If so, in your scenario, you could choose to use PAT token to access your git repo and do the clone. Detail info and sample command line, you could refer my updated reply. Just a limitation, it require your TFS version be 2017 or higher version. Also need to turn off IIS basic auth on your TFS sever. – PatrickLu-MSFT Nov 26 '19 at 08:50