1

我正在使用docusaurus为产品编写文档网站。我对该站点进行了一些自定义,并尝试将其发布到 GitHub 上。

按照教程,我配置website/siteConfig.js、运行npm run build和使用:

$ GIT_USER=<GIT_USER> CURRENT_BRANCH=master USE_SSH=true npm run publish-gh-pages

将其推送到 Github。克隆到 gh-pages 失败并显示“致命:无法从远程存储库读取”。错误。

以下 git 命令是我使用的。

LM-SHC-16507799:website benshi$ ls

README.md   core        node_modules    sidebars.json   yarn.lock
blog        git     package.json    siteConfig.js
build       i18n        pages       static
LM-SHC-16507799:website benshi$ pwd

/Users/user_name/Desktop/calender/week_3/docusaurus-exp/website

LM-SHC-16507799:website user_name$ GIT_USER=my_github_user_name CURRENT_BRANCH=master USE_SSH=true npm run publish-gh-pages

它失败了。显示了以下错误消息。

> @ publish-gh-pages /Users/user_name/Desktop/calender/week_3/docusaurus-exp/website
> docusaurus-publish

master
https://github.com/my_github_user_name/docusaurus-exp.git
generate.js triggered...
feed.js triggered...
feed.js triggered...
sitemap.js triggered...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
Site built successfully. Generated files in 'build' folder.
89b1f1bd2f7e2403a08a194a89379916edcbb540
Cloning into 'docusaurus-exp-gh-pages'...
ssh_exchange_identification: read: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
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!     /Users/user_name/.npm/_logs/2019-07-18T07_15_37_998Z-debug.log
4

1 回答 1

0

这个问题确实与 Docusaurus 无关。

该错误是我尝试使用 tp 发布站点时引起gh-pages branchUSE_SSH=true。事实上,我没有在这台机器上存储 SSH。该问题已通过移动此参数(或 set USE_SSH=false)得到解决。

于 2019-08-08T05:52:44.777 回答