question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publish-gh-pages script fails -- error: git clone failed

See original GitHub issue

🐛 Bug Report

When trying to publish changes to our github pages hosted site, the npm run publish-gh-pages step fails with the following error code (full output from powershell attached)

generate.js triggered… feed.js triggered… feed.js triggered… sitemap.js triggered… Site built successfully. Generated files in ‘build’ folder. 7ce717117293691c87678f7b3cc7fbe015e946de fatal: Too many arguments. Error: git clone failed npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ publish-gh-pages: docusaurus-publish npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ publish-gh-pages script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\artus\AppData\Roaming\npm-cache_logs\2020-01-30T23_49_07_563Z-debug.log

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

Windows 10 node (12.14.1) npm (6.13.4) yarn (1.21.1)

  1. clone documentation repo locally
  2. make edits in visual studio code
  3. run command: cmd /C “set GIT_USER=[myuser] && set CURRENT_BRANCH=master && npm run publish-gh-pages”
  4. fails 😦

Note – also fails in the same way when using yarn run publish-gh-pages

Expected behavior

My 1st time trying to push changes to our docusaurus site. I expected it to work without any errors.

Actual Behavior

npm run publish-gh-pages failed

Reproducible Demo

Repo that I’m trying to push changes for https://github.com/OpenBCI/Documentation/tree/master

docusaurus-errortxt.txt

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
OndrejNepozitekcommented, Feb 11, 2020

The problem is caused by a whiteline that is appended to the GIT_USER env variable on windows 10 when you run the cmd /C "set GIT_USER=<GITHUB_USERNAME> && yarn deploy" command. It can be fixed by running cmd /C "set GIT_USER=<GITHUB_USERNAME>&& yarn deploy" instead (note the missing space between <GITHUB_USERNAME> and &&).

It’s quite unfortunate that the command is included in the official docs so probably a lot of windows users will encounter this problem.

2reactions
prma85commented, Feb 7, 2020

This is what I have been using in azure and works just fine

git config --global user.email "$(GH_USER)@users.noreply.github.com"
git config --global user.name "$(GH_USER)"
GIT_USER=$(GH_USER) npm run publish-gh-pages

Running it directly from my machine (windows 10) also worked without errors.

I hope it helps 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Publish a change: error Command "publish-gh-pages" not found
Error : Error: git clone failed at build_1.build.then (/Users/chengtie/Downloads/my-website/node_modules/@docusaurus/core/lib/commands/deploy.js: ...
Read more >
Failed to do git clone from a CI CD job into a Windows Gitlab ...
Hi All, I am unable to do git clone successfully in a Gitlab runner running on Windows, ... Executing “step_script” stage of the...
Read more >
Run Git commands in a script - Azure Pipelines - Microsoft Learn
Learn how you can run a Git command in a build script for your workflow ... is failing with the following error: "Error:...
Read more >
Git Clone Fails - error: RPC failed; result=56, HTTP code = 200
During a clone or fetch, Git fails with the following error: git clone http://stash.company.com:7990/scm/proj/repo.git fatal: early EOF fatal: ...
Read more >
Bitbucket HTTPS git clone failed via the pipeline script (Invalid ...
Then it threw out an error message and "git clone" will just fail. (If I change it to use SSH, it will work.)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found