hexo-cli icon indicating copy to clipboard operation
hexo-cli copied to clipboard

Hexo init failed on `git clone`

Open chilly opened this issue 2 years ago • 2 comments

Check List

Please check followings before submitting a new feature request.

  • [Y] I have already read Docs page
  • [Y ] I have already searched existing issues

Feature Request

Execute hexo init blog in my window10. Tips is

INFO  Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
fatal: unable to access 'https://github.com/hexojs/hexo-starter.git/': Recv failure: Connection was reset
WARN  git clone failed. Copying data instead
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html

I execute the cmd:

git clone --recurse-submodules --depth=1 --quiet https://github.com/hexojs/hexo-starter.git blog

It's not work. But if I execute the below cmd:

git clone --recurse-submodules --depth=1 --quiet [email protected]:hexojs/hexo-starter.git blog

It's work.

So I changed $basedir/node_model/hexo_cli/dist/console/init.js rewite GIT_REPO_URL as [email protected]:hexojs/hexo-starter.git; And redo hexo init blog.

It's work.

I think it's a point you can improve.

Others

chilly avatar Oct 04 '23 16:10 chilly

This is a well-known network problem. You can use proxy or ssh to resolve it.

rewite GIT_REPO_URL as [email protected]:hexojs/hexo-starter.git

clone via ssh need a ssh key, but https not. I think we can't assume that the user has configured ssh key.

uiolee avatar Oct 05 '23 12:10 uiolee

https://github.com/hexojs/hexo-cli/blob/8a302b2331c05599f479f598f127aad847d86348/lib/console/init.ts#L26-L37

According to the code, hexo init should copy the hexo-starter in the bundle if git clone failed. But it looks like failed.


I can't reproduce your case. It will copy the internal hexo-starter files after git clone failed.

INFO  Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
fatal: unable to access 'https://github.com/hexojs/hexo-starter.git/': Failed to connect to github.com port 443 after 21057 ms: Couldn't connect to server
WARN  git clone failed. Copying data instead
INFO  Install dependencies

uiolee avatar Jan 14 '24 08:01 uiolee