解决用Hexo和GitHub搭建博客时hexo d命令报错问题
来源:互联网 发布:mac照片导入iphone x 编辑:程序博客网 时间:2024/04/27 16:21
这两天学着使用hexo和github page搭建个人博客
到使用hexo deploy自动部署到github page的时候出现了错误:
FATAL bash: /dev/tty: No such device or addresserror: failed to execute prompt script (exit code 1)fatal: could not read Username for 'https://github.com': Invalid argumentError: bash: /dev/tty: No such device or addresserror: 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才解决了问题。
具体方法如下:
hexo配置
要使用自动部署首先要安装hexo-deployer-git工具:
$ npm install hexo-deployer-git --save
配置_config.yml中的deploy:
deploy: type: git repo:git@github.com:your_github_user_name/your_github_user_name.github.io.git branch: master
注意:这里的repo需要设置成你git仓库的ssh链接
生成 ssh key
命令行中输入:
$ ssh-keygen -t rsa -C greenovia@qq.com(换成你的邮箱地址)
接着出现的一些步骤都可以回车跳过,如下:
这样在 /c/Users/Administrator/.ssh/id_rsa文件中就生成了公钥
配置github账户的ssh key
打开id_rsa.pub文件将一整串公钥拷贝下来
进入你的github账户设置,在ssh and GPG keys中新增一个ssh key,如下
把刚刚拷贝出来的公钥粘贴到key中,title放空就好
验证ssh key:
$ ssh -T git@github.com
出现下面的语句说明你的ssh key已经配置好了
Hi wispyoureyes! You've successfully authenticated, but GitHub does not provide shell access.
初始化本地git仓库
设置Git的user name和email:
$ git config --global user.name "wuyanqina"$ git config --global user.email "greenovia@qq.com"(换成你的邮箱地址)
在本地的hexo init生成的文件夹中初始化git仓库:
$ git init
将本地仓库和远程仓库连接(这一步骤可以不做):
$ git remote add origin git@github.com:your_github_user_name/your_github_user_name.github.io.git(远程仓库ssh地址)
做完以上这些步骤,说明你的仓库可以使用ssh方式来上传下载代码,而不需要输入用户名和密码了
网站部署
$ hexo clean //清除缓存文件db.json和已生成的静态文件public$ hexo g //生成网站静态文件到默认设置的public文件夹$ hexo d //部署网站到设定的仓库
部署成功后会提示:
这样你的博客就部署到了page上了~~
1 0
- 解决用Hexo和GitHub搭建博客时hexo d命令报错问题
- 解决用Hexo和GitHub搭建博客时hexo d命令报错问题
- 问题1:有关使用 Hexo 和 GitHub 搭建博客,出现 hexo -d 报错如何解决?(windows下)
- 问题2:有关使用 Hexo 和 GitHub 搭建博客,出现 hexo -d 报错如何解决?(windows下)
- 用hexo和github-pages搭建博客
- 用GitHub和Hexo搭建个人博客
- 用Hexo搭建github博客
- hexo搭建github博客
- hexo+github搭建博客
- Hexo+Github 博客搭建
- Hexo+github博客搭建
- github+hexo博客搭建
- Hexo Github 搭建博客
- Hexo + GitHub 博客搭建
- hexo+github搭建博客
- hexo + github 博客搭建
- hexo+github 搭建博客
- Hexo + Github搭建博客
- ANDROID Toolbar
- Xcode7版本之后 .dylib变成了.tbd解决方法
- C语言中函数返回字符串的四种方法
- HTML中的disabled属性
- QML基础——QML国际化(中文示例)
- 解决用Hexo和GitHub搭建博客时hexo d命令报错问题
- 日本语整理
- 引用数据类型参数传递
- Struts2框架开发环境配置
- Linux安装JDK详细步骤
- CentOS增加IP地址
- 如何保证测试的覆盖率
- RGB转XYZ色彩空间开发及matlab实验笔记整理
- Axure谷歌浏览器Chrome扩展程序下载及安装方法