Skip to content

Error: Error while executing command git remote get-url origin #11367

@Sunburst7

Description

@Sunburst7

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

i update docusaurus to v3.8.1 recently, i want to deploy it on github page, when i run command: " cmd /C 'set "USE_SSH=true" && yarn deploy'" a error occured.

here is my version info:

  "packages": {
    "": {
      "name": "my-website",
      "version": "0.0.0",
      "dependencies": {
        "@docusaurus/core": "^3.8.1",
        "@docusaurus/preset-classic": "^3.8.1",
        "@docusaurus/theme-mermaid": "^3.8.1",
        "@mdx-js/react": "^3.0.0",
        "clsx": "^2.0.0",
        "prism-react-renderer": "^2.3.0",
        "react": "^19.0.0",
        "react-dom": "^19.0.0",
        "rehype-katex": "7",
        "remark-math": "6"
      },
      "devDependencies": {
        "@docusaurus/module-type-aliases": "^3.8.1",
        "@docusaurus/tsconfig": "^3.8.1",
        "@docusaurus/types": "^3.8.1",
        "typescript": "~5.6.2"
      },
      "engines": {
        "node": ">=18.0"
      }
    },

here is command line info:

PS D:\WorkSpace\my-website> cmd /C 'set "USE_SSH=true" && yarn deploy'
yarn run v1.22.22
$ docusaurus deploy
[INFO] Deploy command invoked...
[INFO] `git --version` code: 0

[ERROR] Error: Error while executing command `git remote get-url origin`
In CWD `D:\WorkSpace\my-website`
    at exec (D:\WorkSpace\my-website\node_modules\@docusaurus\core\lib\commands\deploy.js:47:15)
    at Command.deploy (D:\WorkSpace\my-website\node_modules\@docusaurus\core\lib\commands\deploy.js:77:24)
    ... 2 lines matching cause stack trace ...
    at async file:///D:/WorkSpace/my-website/node_modules/@docusaurus/core/bin/docusaurus.mjs:44:3 {
  [cause]: Error: Command failed with exit code 128: git remote get-url origin
  fatal: not a git repository (or any of the parent directories): .git
      at makeError (D:\WorkSpace\my-website\node_modules\execa\lib\error.js:60:11)
      at module.exports.sync (D:\WorkSpace\my-website\node_modules\execa\index.js:194:17)
      at module.exports.commandSync (D:\WorkSpace\my-website\node_modules\execa\index.js:235:15)
      at exec (D:\WorkSpace\my-website\node_modules\@docusaurus\core\lib\commands\deploy.js:34:40)
      at Command.deploy (D:\WorkSpace\my-website\node_modules\@docusaurus\core\lib\commands\deploy.js:77:24)
      at async Promise.all (index 0)
      at async runCLI (D:\WorkSpace\my-website\node_modules\@docusaurus\core\lib\commands\cli.js:56:5)
      at async file:///D:/WorkSpace/my-website/node_modules/@docusaurus/core/bin/docusaurus.mjs:44:3 {
    shortMessage: 'Command failed with exit code 128: git remote get-url origin',
    command: 'git remote get-url origin',
    escapedCommand: 'git remote get-url origin',
    exitCode: 128,
    signal: undefined,
    signalDescription: undefined,
    stdout: '',
    stderr: 'fatal: not a git repository (or any of the parent directories): .git',
    failed: true,
    timedOut: false,
    isCanceled: false,
    killed: false
  }
}
[INFO] Docusaurus version: 3.8.1
Node version: v22.13.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproducible demo

No response

Steps to reproduce

  1. update version
  2. cmd /C 'set "USE_SSH=true" && yarn deploy'

Expected behavior

when the project try to push the static page to github page, but it can not find .git folder.

Actual behavior

no

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used: v3.8.1
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): v22.13.1
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): windows1 1

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions