首页 > 解决方案 > 如何将 hexo 移至另一台计算机?

问题描述

我正在使用一台新计算机,并且必须将 hexo 移到这台计算机上。这是我的做法。

我实际上在这里克隆了 repo。 我的 github io

之后,我删除所有文件并保留 .git。然后我将所有文件从我的原始计算机复制到这个新的 samohyes.github.io。在此之后,我创建了一个新的分支 hexo。然后,我做了

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

根据教程,我现在可以开始了。但是当我输入

hexo g
hexo d

我懂了。

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)

所以,我认为 ssh 密钥有问题。我可能需要添加一个。然后我输入

ssh-keygen.exe

并在 c:/usr/myname/.ssh/ 获得公钥和私钥。我将公钥上传到 github 上的 repo。在那之后,我做

ssh -T git@github.com

并得到了这个成功的信息。

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.

我现在应该没事了。但是当我输入 hexo d 时,又出现了这个错误。

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)

我编辑 _config.yml 文件更改以下几行。

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

有谁知道为什么?谢谢!

标签: gitgithubhexo

解决方案


推荐阅读