【问题标题】:Failed to get remote.origin.url获取 remote.origin.url 失败
【发布时间】:2022-06-14 13:15:28
【问题描述】:

当尝试使用 gh-pages 部署 React 应用程序时,我收到以下错误

...
$ gh-pages -d build
Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the "repo" option).
...

遥控器设置为origin

$ git remote -v
origin  https://github.com/{user_name}/{repo_name} (fetch)
origin  https://github.com/{user_name}/{repo_name} (push)

【问题讨论】:

标签: git github github-pages


【解决方案1】:

我正在寻找答案,但找到了解决方法。

  1. 在你的机器上安装和设置 docker - https://docs.docker.com/get-docker/

  2. 安装 node:12-alpine 镜像 - docker run node:12-alpine

  3. 启动一个容器

  4. 在容器中安装github-cligit - apk update; apk add git; apk add github-cli;

  5. 使用来自 Github 的 PAT 验证 github-cli - https://github.com/settings/tokens

  6. 安装gh-pages - npm I -D gh-pages

  7. 运行./node_modules/.bin/gh-pages -d build(如果您愿意,可以使用-b master 将分支设置为master)

【讨论】:

    猜你喜欢
    • 2019-07-23
    • 2021-11-17
    • 2012-08-08
    • 1970-01-01
    • 1970-01-01
    • 2020-10-25
    • 2021-07-09
    • 2019-11-19
    • 1970-01-01
    相关资源
    最近更新 更多