Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hexo init failed on git clone #494

Open
chilly opened this issue Oct 4, 2023 · 2 comments
Open

Hexo init failed on git clone #494

chilly opened this issue Oct 4, 2023 · 2 comments

Comments

@chilly
Copy link

chilly commented Oct 4, 2023

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

@uiolee
Copy link
Member

uiolee commented Oct 5, 2023

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 uiolee transferred this issue from hexojs/hexo Oct 5, 2023
@uiolee
Copy link
Member

uiolee commented Jan 14, 2024

if (args.clone) {
try {
await spawn('git', ['clone', '--recurse-submodules', '--depth=1', '--quiet', GIT_REPO_URL, target], {
stdio: 'inherit'
});
} catch (err) {
log.warn('git clone failed. Copying data instead');
await copyAsset(target);
}
} else {
await copyAsset(target);
}

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 uiolee added the bug label Jan 14, 2024
@uiolee uiolee changed the title Hexo init cannot execute Hexo init failed on git clone Jan 14, 2024
@uiolee uiolee removed the bug label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants