1

I am using a new computer and have to move the hexo to this one. Here is how I did it.

I actually clone the repo here. my github io

After that, I delete all the file and keep the .git. Then I copy all the file from my origin computer to this new samohyes.github.io. After this, I create a new branch hexo. Then, I did

git add --all
git commit -m 'new branch'

According to the tutorial, I am good to go now. But when I type

hexo g
hexo d

I got this.

FATAL Something's wrong. Maybe you can find the solution here: 
http://hexo.io/docs/troubleshooting.html
Error: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at ChildProcess.<anonymous> (E:\MyProject\samohyes.github.io\node_modules\hexo-util\lib\spawn.js:37:17)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at ChildProcess.cp.emit (E:\MyProject\samohyes.github.io\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

So, I assume there is something wrong with the ssh key. I may need to add one. Then I type

ssh-keygen.exe

And got the public and private key at c:/usr/myname/.ssh/ .I upload the public key to the repo on github. After that, I do

ssh -T git@github.com

And got this successful information.

PS E:\MyProject\samohyes.github.io> ssh -T git@github.com
Enter passphrase for key 'C:\Users\Xudon/.ssh/id_rsa':
Hi samohyes/samohyes.github.io! You've successfully authenticated, but 
GitHub does not provide shell access.

I should be all right now. But when I type hexo d , again it comes this error.

FATAL Something's wrong. Maybe you can find the solution here: 
http://hexo.io/docs/troubleshooting.html
Error: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at ChildProcess.<anonymous> (E:\MyProject\samohyes.github.io\node_modules\hexo-util\lib\spawn.js:37:17)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at ChildProcess.cp.emit (E:\MyProject\samohyes.github.io\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

And I edit the _config.yml file change the following lines.

deploy:
   type: git
   repo: git@github.com:samohyes/samohyes.github.io.git
   branch: hexo

Anyone know why? Thanks!

Xudong Shao
  • 199
  • 3
  • 12
  • It seems you're using a passphrase for the ssh key and hexo doesn't ask for it. Either use [ssh-agent](https://stackoverflow.com/q/18404272/7976758) or remove the passphrase with `ssh-keygen -P`; in the latter case press twice for "passphrase" and verify the key with `ssh -T git@github.com`; must not ask for a passphrase. – phd May 17 '18 at 05:51
  • Thanks. Your solution works! But I am facing another problem. I am tryig to add a new post. It works well locally. I tried hexo s -p 8888 and the new post shows up locally. But After I use hexo d. The new post didn't show up in my web page. I tried to change the default branch to my new branch hexo but it won't work. Do you have any idea about how to fix it? – Xudong Shao May 18 '18 at 00:12
  • Oh. I see. I have to change the branch in config file to master since the github.io page shows the master branch. – Xudong Shao May 18 '18 at 00:41

0 Answers0