混帐 "fatal: Authentication failed for ' http :. 。来自 Microsoft Visual Studio Team Foundation Server 的 .'"

标签 git ubuntu tfs http-negotiate

我将我的 Ubuntu 升级到 18.10(从 17.10)。现在我无法再从 CLI 连接到我项目的 Microsoft Visual Studio Team Foundation Server(版本 16.131.27701.1)。 (我已经两周没有在存储库上工作了。所以我不知道服务器端是否也同时发生了变化。)

$ git fetch
Username for 'http://....net:8080': NUNNI
Password for 'http://NUNNI@....net:8080': 
fatal: Authentication failed for 'http://....net:8080/tfs/AE/_git/AE-VMT/'

(是的,它不是 HTTPS,而是通过某些 VPN。)

很遗憾,我找不到对我的情况有帮助的答案。

一些研究表明:

$ GIT_CURL_VERBOSE=2 git fetch
...
< WWW-Authenticate: Bearer
< WWW-Authenticate: Negotiate
< WWW-Authenticate: NTLM
...

看来,协商(Kerberos 或 NTLM)或 NTLM 已宣布通过 HTTP header 进行身份验证。

curl --negotiate "http://NUNNI:<password>@....net:8080/tfs/AE/_git/AE-VMT"

不起作用; HTML 标题元素是:

TF400813: Resource not available for anonymous access. Client authentication required. - Microsoft Team Foundation Server

鉴于

curl --ntlm "http://NUNNI:<password>@....net:8080/tfs/AE/_git/AE-VMT"

工作正常。

据我了解https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/understanding-http-authentication , Negotiate 优先于 NTLM

所以对我来说,在这种情况下,cURL 似乎不适用于 Negotiate。 (据我对 MS 文档的理解,连接应该优先使用 Kerberos(如果可用),如果 Kerberos 不可用则回退到 NTLM。)

问题:

  • 如何检查服务器端或我的本地 cURL 是否不支持 Kerberos。
  • 是否有一个选项可以强制 git 使用 NTLM 而不是 Negotiate。 (我在不同的 stackoverflow 文章中阅读了一些关于 HTTP/NTLM 代理的内容,但是当我尝试将 Git 存储库配置为 NTLM 代理时它不起作用 - 我真的没想到它会起作用。)
  • 对于解决问题或获取更多详细信息的任何其他想法?

非常感谢!

最佳答案

如果您使用用户名和密码,则您明确使用 Kerberos。使用用户名和密码进行 HTTP 身份验证与 Kerberos 正交。

How can I check if Kerberos is not supported by the server-side or my local cURL.

运行 klist -5fea 查看您是否有 Kerberos 票证。如果是这样,您应该能够 curl --negotiate 无需指定用户名和密码; curl 将使用您的 Kerberos 票证进行身份验证。如果您没有票,则需要使用 NTLM 并使用用户名和密码,或者使用个人访问 token (PAT)。

Is there an option to force git to use NTLM instead of Negotiate.

是的,使用用户名和密码应该明确禁用协商。

Any other ideas to solve the issue or get more details what's going on?

设置 GIT_CURL_VERBOSE=1GIT_TRACE=1 环境变量。

关于混帐 "fatal: Authentication failed for ' http :. 。来自 Microsoft Visual Studio Team Foundation Server 的 .'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54180923/

相关文章:

git - 如何在 MAC 或 Windows 上更改 GitHub 客户端的外部编辑器?

git - 连接后从代理收到 HTTP 代码 501

git - 如何 "git log"整个存储库而不仅仅是你所在的分支?

visual-studio - Visual Studio - 如何在挂起的更改文件中搜索?

tfs - 更改产品积压项目的区域,包括 TFS 2017 中的子项

unit-testing - 是否有可能找出 TFS 上选定个人 checkin 的变更集的单元测试代码覆盖率?

git 仅将最近的更改从一个存储库 merge 到另一个存储库,这是一个不相关的快照(不是克隆)

windows - Crontab 不能在 Windows 上的 Ubuntu 上使用 Bash

linux - 授予 unix 进程对目录的独占 RW 访问权限

xcode - 在 Ubuntu 上下载 MACOS VMWARE 并运行 Xcode 时遇到的问题