hexo 博客自动化部署请教各位

2022-12-16 13:37:40 +08:00
 sonders

helo-deploy.yml 文件

github 仓库 actions 里 Build and Deploy 没有什么报错,最后有两行这个输出

>>> Config git ...
Initialized empty Git repository in /github/workspace/public/.git/
fatal: not in a git directory

//  hexo d/g 都是成功的 

github token 更新换了几个了,都是这个信息输出,请问彦祖们这个是什么引起的,因为最近没动过配置信息

741 次点击
所在节点    问与答
13 条回复
sonders
2022-12-16 13:50:11 +08:00
有哪位彦祖遇到过类似的部署问题吗?
liyang5945
2022-12-16 13:55:20 +08:00
这是你用的这个脚本的问题,theme-keep……这个,我用的是这个,部署 out 目录到 master 分支

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: master
folder: out
single-commit: true
sonders
2022-12-16 13:56:58 +08:00
和成功的对比了下,发现 成功的信息输出是
```js
找到了访问仓库的 gh-pages 分支,而失败的同行信息是 fatal: not in a git directory
```
sonders
2022-12-16 13:59:26 +08:00
@liyang5945 一直用的都是这个,三天前还成功提交了一次,theme-keep/hexo-deploy-github-pages-action@master
你的意思是说这个脚本本身出了问题?
shmilyab
2022-12-16 22:35:41 +08:00
哇老哥我现在就在搞这个,和你一样的问题。这是怎么回事,我在作者官方群里提出问题了但是没人解答。
shmilyab
2022-12-16 22:36:22 +08:00
老哥你解决了吗
AsyncX
2022-12-17 14:14:54 +08:00
不如换个脚本?

# workflow name
name: Hexo Blog CI

# master branch on push, auto run
on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
# check it to your workflow can access it
# from: https://github.com/actions/checkout
- name: Checkout Repository master branch
uses: actions/checkout@master

# from: https://github.com/actions/setup-node
- name: Setup Node.js 12.x
uses: actions/setup-node@master
with:
node-version: "12.x"

- name: Setup Hexo Dependencies
run: |
npm install hexo-cli -g
npm install

- name: Setup Deploy Private Key
env:
HEXO_DEPLOY_PRIVATE_KEY: ${{ secrets.HEXO_DEPLOY_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh/
echo "$HEXO_DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts

- name: Setup Git Infomation
run: |
git config --global user.name 'xxxx'
git config --global user.email 'xxxx'
- name: Deploy Hexo
run: |
hexo clean
hexo generate
hexo deploy
shmilyab
2022-12-17 14:55:01 +08:00
@AsyncX 老哥,我完全新手,想问下你这个脚本要怎么配置。比如这个文件要放到哪里。要怎么改。
sonders
2022-12-17 20:52:50 +08:00
@shmilyab 没有解决呢,提了 issue ,等几天看看
sonders
2022-12-17 20:53:31 +08:00
@shmilyab 我电脑坏了,等周一给你截个图参照文件目录
sonders
2022-12-17 20:54:00 +08:00
@AsyncX 好的,回去试一下
shmilyab
2022-12-17 21:42:36 +08:00
@sonders 非常感谢
sonders
2022-12-19 13:08:22 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/902927

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX