Mac电脑重新启动后hexo d需要输入密码

问题描述

在一次我Mac电脑重启后,hexo部署文章时,需要手动输入密码

在确认ssh密钥已经配置后,开始网上搜索Mac重启后密钥失效问题。

ssh密钥确认

/Users/tingyu/.ssh 目录下存在id_rsa和id_rsa.pub两个文件

![](https://raw.githubusercontent.com/YUTING0907/PicGo/main/img截屏2022-08-11 下午11.16.32.png)

再去查看github的settings-》SSH and GPG keys也已经配置过

但是在执行hexo d命令的时候,仍然要求输入密码

1
2
3
4
5
6
7
8
9
10
(base) tingyu@TINGdeMacBook-Pro blog % hexo d
INFO Validating config
WARN Deprecated config detected: "external_link" with a Boolean value is deprecated. See https://hexo.io/docs/configuration for more details.
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
INFO Copying files from extend dirs...
On branch master
nothing to commit, working tree clean
Enter passphrase for key '/Users/tingyu/.ssh/id_rsa':

解决方案

为了不必在重新启动后填写密码,请将以下内容添加到ssh配置文件中(通常位于/.ssh/config),即在/.ssh/目录下新建config文件,写入以下内容

1
2
3
4
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa

之后密码会在重启Mac后被记住!

1
2
3
4
5
6
7
8
9
10
11
12
(base) tingyu@TINGdeMacBook-Pro blog % hexo d
INFO Validating config
WARN Deprecated config detected: "external_link" with a Boolean value is deprecated. See https://hexo.io/docs/configuration for more details.
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
INFO Copying files from extend dirs...
On branch master
nothing to commit, working tree clean
Branch 'master' set up to track remote branch 'master' from 'git@github.com:YUTING0907/YUTING0907.github.io.git'.
Everything up-to-date
INFO Deploy done: git

参考:https://www.codenong.com/21095054/


觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭



wechat pay



alipay

Mac电脑重新启动后hexo d需要输入密码
http://yuting0907.github.io/2022/08/11/Mac电脑重新启动后hexo-d需要输入密码/
作者
Echo Yu
发布于
2022年8月11日
许可协议