首页 > 解决方案 > bazel 同步请求 github 登录并失败

问题描述

我不知道这是不是因为我今天不得不更改我的 github 密码,或者它是否与 github 切换到使用令牌而不是密码进行访问有关。

我一直在使用local_repository我的各种项目之间的依赖关系,因为当我迁移到 bazel 时,它们中的很多都在不断变化,并且必须不断地推送到 github,然后为每个增量更改重新同步是没有意义的。

今天我终于准备好开始切换回使用git_repository依赖项了。

除此之外,我发现我无法在网络上登录 github 并最终重置了我的密码(我怀疑我不小心在我的密码管理器中弄乱了一些东西)。

无论如何,我能够毫无问题地将第一个项目更改全部提交并推送到 github。当我进入第二个项目时,我将项目#1 的依赖项从 alocal_repository更改为 agit_repository并尝试bazel sync获取我刚刚在那里提交的更改。

结果: github 的登录窗口弹出,我尝试了我刚刚成功用于登录网络的登录凭据。该框消失并重新出现,当我再次尝试相同的凭据时,我得到了以下错误。

我过去使用过相同的命令,一切正常。我不知道密码更改是否是问题,旧密码是否卡在某个地方,或者 github 切换到需要令牌是否是问题。我发现this link about using github tokens with bazelisk abnd 尝试为新创建的令牌设置环境变量BAZELISK_GITHUB_TOKEN,但这没有帮助。我不知道从这里去哪里。

错误:

C:\projects\java\common>bazel sync
INFO: Repository bdl_deps instantiated at:
  C:/projects/java/common/WORKSPACE:5:15: in <toplevel>
Repository rule git_repository defined at:
  C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in <toplevel>
ERROR: An error occurred during the fetch of repository 'bdl_deps':
   Traceback (most recent call last):
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl", line 181, column 30, in _git_repository_implementation
                update = _clone_or_update(ctx)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, column 20, in _clone_or_update
                git_ = git_repo(ctx, directory)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, column 12, in git_repo
                _update(ctx, git_repo)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 103, column 10, in _update
                fetch(ctx, git_repo)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 145, column 15, in fetch
                _error(ctx.name, ["git"] + args, st.stderr)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 190, column 9, in _error
                fail("error running '%s' while working with @%s:\n%s" % (command_text, name, stderr))
Error in fail: error running 'git fetch origin master:origin/master' while working with @bdl_deps:
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
ERROR: Error fetching repository: Traceback (most recent call last):
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl", line 181, column 30, in _git_repository_implementation
                update = _clone_or_update(ctx)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, column 20, in _clone_or_update
                git_ = git_repo(ctx, directory)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, column 12, in git_repo
                _update(ctx, git_repo)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 103, column 10, in _update
                fetch(ctx, git_repo)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 145, column 15, in fetch
                _error(ctx.name, ["git"] + args, st.stderr)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 190, column 9, in _error
                fail("error running '%s' while working with @%s:\n%s" % (command_text, name, stderr))
Error in fail: error running 'git fetch origin master:origin/master' while working with @bdl_deps:
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
ERROR: no such package '@bdl_deps//': error running 'git fetch origin master:origin/master' while working with @bdl_deps:
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
Loading: loading...

C:\projects\java\common>bazel version
Bazelisk version: v1.3.0
Build label: 4.1.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri May 21 11:17:01 2021 (1621595821)
Build timestamp: 1621595821
Build timestamp as int: 1621595821

C:\projects\java\common>clear

C:\projects\java\common>bazel sync
INFO: Repository bdl_deps instantiated at:
  C:/projects/java/common/WORKSPACE:5:15: in <toplevel>
Repository rule git_repository defined at:
  C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in <toplevel>
ERROR: An error occurred during the fetch of repository 'bdl_deps':
   Traceback (most recent call last):
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl", line 181, column 30, in _git_repository_implementation
                update = _clone_or_update(ctx)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, column 20, in _clone_or_update
                git_ = git_repo(ctx, directory)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, column 12, in git_repo
                _update(ctx, git_repo)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 103, column 10, in _update
                fetch(ctx, git_repo)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 145, column 15, in fetch
                _error(ctx.name, ["git"] + args, st.stderr)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 190, column 9, in _error
                fail("error running '%s' while working with @%s:\n%s" % (command_text, name, stderr))
Error in fail: error running 'git fetch origin master:origin/master' while working with @bdl_deps:
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
ERROR: Error fetching repository: Traceback (most recent call last):
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl", line 181, column 30, in _git_repository_implementation
                update = _clone_or_update(ctx)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, column 20, in _clone_or_update
                git_ = git_repo(ctx, directory)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, column 12, in git_repo
                _update(ctx, git_repo)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 103, column 10, in _update
                fetch(ctx, git_repo)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 145, column 15, in fetch
                _error(ctx.name, ["git"] + args, st.stderr)
        File "C:/_bazel_out/seszwrcl/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 190, column 9, in _error
                fail("error running '%s' while working with @%s:\n%s" % (command_text, name, stderr))
Error in fail: error running 'git fetch origin master:origin/master' while working with @bdl_deps:
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
ERROR: no such package '@bdl_deps//': error running 'git fetch origin master:origin/master' while working with @bdl_deps:
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
Loading: loading...

更多信息:

C:\projects\java\common>bazel version
Bazelisk version: v1.3.0
Build label: 4.1.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri May 21 11:17:01 2021 (1621595821)
Build timestamp: 1621595821
Build timestamp as int: 1621595821

操作系统:Windows 10。

标签: githubbazel

解决方案


推荐阅读