1. 程式人生 > >TFS(Visual Studio Team Services) Git認證失敗 authentication fails 的解決方案

TFS(Visual Studio Team Services) Git認證失敗 authentication fails 的解決方案

TFS git認證配置

TFS2015 visual studio中使用正常,可是git bash執行失敗,提示 authentication fails。這是由於windows驗證方式,在git中的識別問題。git自帶有credential.helper,預設為manager,需要設定system與global級別為credential.helper wincred。然後在windows控制面板新增git認證所需的賬戶密碼。解決方案如下:

1.設定git credential.helper 為 wincred ,以管理員身份啟動cmd輸入下述指令。

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

使用管理員身份的原因是system級別需要管理員許可權,git bash預設沒有管理員許可權。system配置的預設路徑為:C:\Program Files\Git\mingw64\etc\gitconfig

2.此時使用git pull或git clone應該會提示輸入密碼,按提示輸入賬戶密碼後,即可正常使用。

3.如果未出現輸入使用者密碼提示,而仍舊提示使用者認證失敗。這是由於已儲存的windows憑據不滿足git要求的認證格式導致,此時可以手動新增,新增方法為:

開啟:控制模板-使用者賬戶-憑據管理器-Windows憑據-新增普通憑據 輸入:

git:http://[email protected]
:port username pwd

其中username為使用者名稱,tfsserver為tfs伺服器ip,port為伺服器埠號,pwd為使用者密碼。