hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.29k stars 4.83k forks source link

Win10使用ssh的hexo deploy到github報錯 #3339

Closed chesskuo closed 5 years ago

chesskuo commented 5 years ago

Macbook是可以正常deploy 但是Win10卻報錯 我已經有重新將原本放在mac上的檔案重新拉過來了 但是一樣噴錯...

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> (C:\Users\Chess\Desktop\blog.chessguo.tw\node_modules\hexo-util\lib\spawn.js:37:17)
    at ChildProcess.emit (events.js:182:13)
    at ChildProcess.cp.emit (C:\Users\Chess\Desktop\blog.chessguo.tw\node_modules\cross-spawn\lib\enoent.js:40:29)
    at maybeClose (internal/child_process.js:961:16)
    at Socket.stream.socket.on (internal/child_process.js:380:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close (net.js:599:12)

_config.yml配置如下

deploy:
  type: git
  repo: git@github.com:gyc880323/blog.chessguo.tw.git
  branch: gh-pages

但是單純使用git push卻能正常ssh push上去 麻煩各位大大幫忙了ˊˋ

tomap commented 5 years ago

It seems your are missing some rights. Can you try a basic got command? Git fetch ?

chesskuo commented 5 years ago

Sorry sir, my english is not good... so I maybe not understand what you mean completely...ˊˋ Do you mean using command git push in .deploy_git folder?

tomap commented 5 years ago

Yes, to check your credentials

Le jeu. 8 nov. 2018 à 09:43, Chess notifications@github.com a écrit :

Sorry sir, my english is not good... so i maybe not understand what you mean completely...ˊˋ Do you mean using command git push in .deploy_git folder?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hexojs/hexo/issues/3339#issuecomment-436916357, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJY_k3UlV1Yob77Ndx6ujfC1-Y3LiBsks5us-65gaJpZM4YSgzf .

chesskuo commented 5 years ago

I think it is Win10 problem... I already create a new repo and a new hexo file to check ssh deploy, but it still is ERROR and I don't know why the file config in .deploy_git/.git is different of mac file

yoshinorin commented 5 years ago

How about use https ? Like this.

deploy:
  type: git
  repo: https://github.com/gyc880323/blog.chessguo.tw.git
  branch: gh-pages
chesskuo commented 5 years ago

it can work if I use https~~ but I would just like to know why ssh can not deploy on Win10. QQ because it can on MacOS

kuyeduwu commented 5 years ago
  1. Are you sure that your private key is correctly configured on your Win10?
  2. If there are any passphrase for your key? If yes, you can try to run the hexo d command from windows command prompt, I receive the same error if I deploy from the terminal window of VSCode, but works well from windows command prompt.
chesskuo commented 5 years ago
  1. Yes, I'm sure my private key is correct.
  2. Yes, the key is passphrase. I already try using hexo d in CMD, but it cannnot still work...
Bryce1010 commented 5 years ago

So have you figured it out? I'm facing the same problem.

Bryce1010 commented 5 years ago

I jush solved it. It seems something wrong with my network proxy swith,which make it difficult for my computer to get to github.

chesskuo commented 5 years ago

No~ It still doesn't work~ I have no idea. XD

kuyeduwu commented 5 years ago

Do you have multiple keys in your ~/.ssh/ directory? You can try to create a config file under the ~/.ssh/ directory with the following content:

Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/YourPrivateKeyFileName
User Yourname

Maybe the ssh picked the wrong key file.

chesskuo commented 5 years ago

I have only one key in ~/.ssh/. But if i just use git push, it can work well. so I don't know why hexo cannot use ssh to deploy on my Win10.

kuyeduwu commented 5 years ago

In you CMD, try to run ssh-add ~/.ssh/id_rsa, then try to deploy again.

Reference: https://github.com/hexojs/hexo/issues/2312

chesskuo commented 5 years ago

emmm... It is always error Error connecting to agent: No such file or directory.

solirpa commented 5 years ago

你的密钥是不是要验证的?还是-P “”?

chesskuo commented 5 years ago

是要驗證的 git push可正常跳出打密碼的訊息 但hexo d並沒有跳出驗證訊息 直接就噴錯了

solirpa commented 5 years ago

是要驗證的 git push可正常跳出打密碼的訊息 但hexo d並沒有跳出驗證訊息 直接就噴錯了

emmmm,rsa的密码置空就好了,hexo-deployer-git自动帮忙输入密码了,很难受。

chesskuo commented 5 years ago

感謝大大!!! 真的是密碼問題XD 不過也太玄學了吧 mac的還是會跳出輸入密碼的地方 怎麼到win10就炸開