2021-01-03-设解决使用hexo deploy推送代码到github仓库时重复输入账户密码


title: 解决使用hexo deploy推送代码到github仓库时重复输入账户密码
description: 解决使用hexo deploy推送代码到github仓库时重复输入账户密码
tags:

  • hexo
  • 博客
  • github
    categories: hexo
    date: 2021-01-03 19:44:00

解决使用hexo deploy推送代码到github仓库时重复输入账户密码

1.生成SSH密钥
cd ~/.ssh

使用ssh -Keygen 生成密钥

ssh-keygen -t rsa -C "your_email@example.com"

后面的输入均使用默认值,点击enter回车跳过

密钥生成成功

Your identification has been saved in /home/you/.ssh/id_rsa.
Your public key has been saved in /home/you/.ssh/id_rsa.pub.
The key fingerprint is:
…………………此处是密钥内容…………………… your_email@example.com

点击复制

2.设置GitHub仓库的密钥

点击SSh and GPG keys,后新建一个SSh key

image-20210103194924377

输入密钥的title,可自定义输入,下面的key的内容即为刚才生成的密钥内容,将其复制粘贴进去,后点击add ssh key即可创建成功

image-20210103195020682

3.测试配置是否成功
ssh -T git@GitHub.com

如果看到successfully,即为配置完成并且成功

image-20210103195309236

4.修改博客Git远程提交的地址
# 修改 https 协议为 ssh 协议(仓库的ssh地址)
git remote set-url origin git@github.com:xxx/xxx.git
5.修改hexo根目录下的_config.yml文件中的远程仓库设置
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
  type: git
  repository: git@github.com:looles/looles.github.io.git
  branch: master
6.部署推送到远程仓库

ub.com:looles/looles.github.io.git
branch: master


#### 6.部署推送到远程仓库

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值