TFS(Visual Studio Team Services) git认证失败 authentication fails 的解决方案

问题描述

TFS 在visual studio中使用正常,可是git pull运行失败,提示 authentication fails。
初步判断原因为默认的 credential.helper 与 TFS 不兼容导致。
TFS 2015 与 Azure Devops(TFS 2019)都有这个问题。TFS2019建议使用ssh认证方式绕过这个问题,这样也更加安全。

解决方法

使用管理员身份运行 git-bash / cmd / powershell 执行以下指令

git config --system credential.helper wincred

再次执行git pull,依照提示输入正确的账号密码即可。

管理凭证可打开:windows控制面板-用户账户-凭据管理器-Windows凭据-普通凭据。如果存储的凭据有误,可修改或删除错误的凭据。

进阶配置详解

有关credential helper for windows的详细内容:https://github.com/Microsoft/Git-Credential-Manager-for-Windows
git使用credential.helper来存储凭证。默认为manager(system级别)。在安装git时,会默认安装 credential.helper。
1114902-20181031113333429-1822532390.png

查看系统支持的credential.helper

git help -a | grep credential-

查看已保存的相关设置

git config --global -l | grep credential.helper
git config --system -l | grep credential.helper

去除credential.helper 设置,system级别需要管理员权限,system级别的配置会覆盖global级别的设置。

git config --system --unset credential.helper 
git config --global --unset credential.helper 

清除保存的凭证 https://stackoverflow.com/questions/15381198/remove-credentials-from-git

git credential-manager clear

Linux系统环境,可设置credential.helper为store

使用store会将密码明文存储,查看或修改已存储的密码可编辑配置文件 ~\.git-credentials

转载于:https://www.cnblogs.com/wswind/p/9828805.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值