【问题标题】:VSTS - Getting source code from GitHub via Personal Access TokenVSTS - 通过个人访问令牌从 GitHub 获取源代码
【发布时间】:2018-02-01 15:12:21
【问题描述】:

我刚刚在 GitHub 上设置了一个新的存储库并添加了一个 .NET Core 解决方案。我已经在 GitHub 中创建了个人访问令牌。

在 Visual Studio Team Services online 中,我已将“获取源”设置为使用 GitHub,并选择使用我的 PAT,将令牌字符串粘贴进去。它亮绿色表示已建立连接,并且确实可以选择我需要的仓库。

在托管云代理上构建失败:

2018-02-01T12:56:18.3505619Z ##[section]Starting: Get Sources
2018-02-01T12:56:18.5131672Z Syncing repository: lukepuplett/standard-extensions (GitHub)
2018-02-01T12:56:18.5218130Z Prepending Path environment variable with directory containing 'git.exe'.
2018-02-01T12:56:18.9399524Z ##[command]git version
2018-02-01T12:56:20.4345074Z git version 2.14.3.windows.1
2018-02-01T12:56:20.4697423Z ##[command]git lfs version
2018-02-01T12:56:27.9772252Z git-lfs/2.3.4 (GitHub; windows amd64; go 1.8.3; git d2f6752f)
2018-02-01T12:56:28.0252003Z ##[command]git init "d:\a\1\s"
2018-02-01T12:56:28.9023657Z Initialized empty Git repository in d:/a/1/s/.git/
2018-02-01T12:56:28.9083315Z ##[command]git remote add origin https://github.com/lukepuplett/standard-extensions.git
2018-02-01T12:56:29.1145696Z ##[command]git config gc.auto 0
2018-02-01T12:56:29.3007766Z ##[command]git config --get-all http.https://github.com/lukepuplett/standard-extensions.git.extraheader
2018-02-01T12:56:29.3334527Z ##[command]git config --get-all http.proxy
2018-02-01T12:56:29.3767712Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ********" fetch --tags --prune --progress --no-recurse-submodules origin
2018-02-01T12:56:37.4510516Z fatal: could not read Username for 'https://github.com': terminal prompts disabled
2018-02-01T12:56:39.5779857Z ##[error]Git fetch failed with exit code: 128
2018-02-01T12:56:39.6331761Z ##[section]Finishing: Get Sources

我原以为这会正常工作,尤其是考虑到构建定义编辑器 UI 正常亮起。

我只是运行了几次构建,​​所以我可以看到任何记录在 GitHub 上的安全位中的事件,但没有提到它,这很奇怪。

注意:我有 2FA 设置。

有没有人从 VSTS 中获得了这个开箱即用的功能?

【问题讨论】:

  • 您在 GitHub 中创建 PAT 时,勾选了哪些权限?对于笑容和笑声,我会创建一个新的并检查每个权限,只是为了排除权限问题。仅供参考,为我使用 PAT 的作品,尽管我访问的是公共存储库,而不是私有存储库。
  • 我添加了所有看起来正确的repo,我也再次检查了。但我喜欢这个主意。
  • 嗯,现在快速检查一下——我可以从构建定义编辑器“浏览”repo;如果我添加一个 Copy Files 步骤,那么我可以点击 [...] 并选择一个文件,所以我猜它会将 repo 拉下来。
  • 尝试从命令提示符本地运行相同的命令,在获取步骤期间提供相同的 PAT。它有效吗?那么它在VSTS中有问题,它会失败吗?可能是 GitHub 出了点问题。
  • @LukePuplett 如果禁用双因素身份验证然后再次构建 VSTS 会怎样?

标签: github azure-devops


【解决方案1】:

经过 Microsoft 支持和我本人的调查后,我们发现它不知何故是来自 GitHub 的损坏令牌。

支持人员无法复制它;它在他的机器上工作;)

制作具有所有权限的新令牌有效。然后我将所有权限删除回应用于问题令牌的相同权限,它继续正常工作。

【讨论】:

    猜你喜欢
    • 2018-12-27
    • 2018-06-06
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    • 2020-01-06
    • 2021-12-12
    • 2021-09-04
    • 1970-01-01
    相关资源
    最近更新 更多