使用 Visual Studio 2017 或 2019 和 AAD 帐户从 MSA 支持的 Azure DevOps 克隆存储库 [英] Cloning repository from MSA backed Azure DevOps using Visual Studio 2017 or 2019 and AAD account

查看:29
本文介绍了使用 Visual Studio 2017 或 2019 和 AAD 帐户从 MSA 支持的 Azure DevOps 克隆存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft 引入了邀请 AAD 用户加入 MSA 支持的 Azure DevOps 帐户的选项.这对于将帐户从非托管"过渡到托管"的公司来说非常有用,首先将帐户所有权转移给 AAD 用户,然后以较慢的方法修复用户和许可混乱.

但是,当我尝试使用 Visual Studio 2017 或 2019 克隆存储库时,收到一条错误消息:

<块引用>

Git 因致命错误而失败.身份验证失败:{remote-url}.

或者,取决于您拥有的 Git 凭证管理器版本:

<块引用>

错误:无法生成 askpass:没有这样的文件或目录致命:无法读取{remote-url}"的用户名:终端提示已禁用`

从命令行克隆时,没有问题,之后,Visual Studio 也可以使用生成的 git 存储库.

解决方案

更新

<块引用>

最新版本的 os Visual Studio 2017 (15.9.10+) 现在包含 Git Credential Manager 的 1.18.4 版,应该可以解决由旧版本引起的许多问题.如果您需要更新版本的 GCMfW,同样的技巧也适用于较新版本.

<小时><块引用>

在与 Chad Boles(在 Visual Studio 中维护团队资源管理器)交谈后,我们找到了另一个选择.这比覆盖 Visual Studio 安装中的文件更可取,因为这可能会破坏未来的更新,并可能导致未来难以调试的问题.

  1. 安装最新的GCMW-1.xx.xx.exe 和/或更新到最新版本的 Git for Windows 应该包括 GCM.
  2. 更新您的全局 git 配置以指向 Git 凭证管理器的特定实现:

    c:>git config --global --edit

    [credential] 部分更新为:

    [凭证]helper = C:\\Program\ Files\\Git\\mingw64\\libexec\\git-core\\git-credential-manager.exe

    确保路径指向可以在您的系统上找到最新 Git Credential Manager 的位置.注意使路径在全局 git 配置中工作所需的所有转义.

Microsoft has introduced the option to invite AAD users into MSA backed Azure DevOps accounts. This is great for companies that are transitioning accounts over from "unmanaged" to "managed", starting with transferring account ownership to an AAD user and then fixing the user and licensing mess in a slower approach.

However, when I try to clone a repository using Visual Studio 2017 or 2019, I'm greeted with an error message:

Git failed with a fatal error. Authentication failed for: {remote-url}.

or, depending on which version of the Git credential manager you have:

error: cannot spawn askpass: No such file or directory fatal: could not read Username for '{remote-url}': terminal prompts disabled`

When cloning from the command line, there are no issues and afterward, Visual Studio can also use the resulting git repository.

解决方案

Update

The latest version os Visual Studio 2017 (15.9.10+) now contains version 1.18.4 of the Git Credential Manager and should solve many of the issues that were caused by the older versions. Should you need a more recent version of the GCMfW, the same trick should work for newer versions too.


After chatting with Chad Boles (who maintains Team Explorer in Visual Studio), we worked out another option. This is preferred over overwriting the files in the Visual Studio installation as this may break future updates and can cause hard to debug issues in the future.

  1. Install the latest GCMW-1.xx.xx.exe in your system and/or update to the latest version of Git for Windows which should include GCM.
  2. Update your global git config to point to a specific implementation of the Git credential Manager:

    c:>git config --global --edit
    

    Update the [credential] section to read:

    [credential]
        helper = C:\\Program\ Files\\Git\\mingw64\\libexec\\git-core\\git-credential-manager.exe
    

    Ensure the path points to where the latest Git Credential Manager can be found on your system. Mind all of the escapes needed to make paths work in the global git config.

这篇关于使用 Visual Studio 2017 或 2019 和 AAD 帐户从 MSA 支持的 Azure DevOps 克隆存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆