hexo+git+阿里云本地使用出现的问题笔记

本地问题:
问题1:
$ hexo d
ERROR Deployer not found: git

解决:
npm install --save hexo-deployer-git

问题2:
/d/mybolg/first
$ …/node_modules/.bin/hexo generate -d
INFO Start processing
INFO Files loaded in 87 ms
INFO 0 files generated in 208 ms
INFO Deploying: git
INFO Setting up Git deployment…
Initialized empty Git repository in D:/mybolg/first/.deploy_git/.git/
Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name “Your Name”
to set your account’s default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address
FATAL Something’s wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess. (D:\mybolg\first\node_modules\hexo-util\lib\spawn.js:52:19)
at ChildProcess.emit (events.js:198:13)
at ChildProcess.cp.emit (D:\mybolg\first\node_modules\cross-spawn\lib\enoent.js:40:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

解决:
上面的方法配置的是全局的用户名和邮箱!就是说如果没有单独为项目配置,那提交的所有项目全部都是这个名字和邮箱!不管是公司项目还是github,还是码云!很蛋疼有木有,当码云提交记录上出现我名字的时候我都惊呆了!
单独为项目配置的方法(全局和单独配置都存在的时候会默认使用项目单独配置的):
1.打开项目所在目录,找到隐藏的.git文件夹。注意这个文件夹是隐藏的,显示隐藏出来就行。
2.打开文件夹里的config文件,推荐用nodepad++打开。
3.添加这三行到文件:
[user]
name = XXX(自己的名称)
email = XXXX(邮箱)
当然也可以通过命令行的方式,只需要在 .git 文件夹下。 例如执行如下命令:
git config user.name "xxxxx"

问题3:
…/node_modules/.bin/hexo generate -d 成功后,在阿里云服务器上没有内容:
解决:
需要在服务器上:git --work-tree=/home/www/hexo --git-dir=/home/www/hexo/learngit.git checkout -f
参考:1.https://www.jianshu.com/p/f3e1662ca34f Hexo&Github Blog 搭建
2.https://blog.csdn.net/a3212/article/details/77099492 手把手教你使用hexo搭建属于你的个人博客

问题4:
**remote: fatal: Unable to create temporary file ‘/home/www/hexo/learngit.git/.git/./objects/pack/tmp_pack_XXXXXX’: Permission denied
fatal: sha1 file ‘’ write error: Broken pipe
error: remote unpack failed: index-pack abnormal exit
error: failed to push some refs to ‘git@hnuscwy.xyz:/home/www/hexo/learngit.git’

解决:
1.首先检查服务器是否创建对应的git仓库,命令:git init ,可发现当前目录多了git文件夹
2.创建好git仓库后,一定要当前仓库给权限:chmod -x .git/
3.再次提交,可提交成功**

问题5:
fatal: ‘/home/www/hexo/learngit.git’ does not appear to be a git repository
fatal: Could not read from remote repository.
注意检查自己的仓库,看下面流程图,是否是按这个流程执行的:

在这里插入图片描述
参考链接:https://segmentfault.com/a/1190000009363890(按照这个流程来执行应该不会有问题)
特别注意:仓库的内容不要自己手动删除
**

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

半点灿烂

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值