使用Hexo deploy 自动部署到github page的时候出现了错误:
FATAL bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument
Error: bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': Invalid argument
最后把_config.yml 中git仓库链接改成了ssh链接,然后给git账户增加了ssh key才解决了问题。
生成 ssh key
命令行中输入:
ssh-key -t rsa -C anguscaiwuhan@qq.com
$ ssh-keygen -t rsa -C 884816034@qq.com
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Angus/.ssh/id_rsa): id_rsa.pub
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.pub.
Your public key has been saved in id_rsa.pub.pub.
The key fingerprint is:
SHA256:48wDY7QtaIxCNDHQPBBomRZo8bLZ2nIUS79Orgmccww 884816034@qq.com
The key's randomart image is:
+---[RSA 2048]----+
|B%* |
|+*B |
|+o = . |
|. *o+o o |
|.E.++.* S |
|..B. ..B . |
| B = o = |
| * = . |
| o.o |
+----[SHA256]-----+
这样在/c/Users/Angus/.ssh/id_rsa文件中就生成了公钥。
配置github账户的ssh key
打开id_rsa.pub文件将一整串公钥拷贝下来
进入你的github账户设置,在ssh and GPG keys中新增一个ssh key
验证ssh key
ssh -T git@github.com
出现下面的语句就说明的ssh key已经配置好了
Hi Angus1996! You've successfully authenticated, but GitHub does not provide she ll access.
修改站点配置文件
将仓库修改为ssh链接,如下:
deploy:
type: git
repository: git@github.com:Angus1996/Angus1996.github.io.git
branch: master
到此就可以一如往常使用hexo d更新博客站点了。