发布我的网站时无法从远程存储库读取

时间:2019-07-18 07:57:59

标签: reactjs git github github-pages docusaurus

我正在使用 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

1 个答案:

答案 0 :(得分:0)

该问题确实与Docusaurus无关。

当我尝试使用gh-pages branch发布站点tp USE_SSH=true时,导致该错误。实际上,我没有在此计算机上存储SSH。通过移动此参数(或设置USE_SSH=false)解决了该问题。