V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
sonders
V2EX  ›  问与答

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

  •  
  •   sonders · 2022-12-16 13:37:40 +08:00 · 730 次点击
    这是一个创建于 496 天前的主题,其中的信息可能已经有所发展或是发生改变。

    helo-deploy.yml 文件 image

    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 更新换了几个了,都是这个信息输出,请问彦祖们这个是什么引起的,因为最近没动过配置信息

    13 条回复    2022-12-19 13:08:22 +08:00
    sonders
        1
    sonders  
    OP
       2022-12-16 13:50:11 +08:00
    有哪位彦祖遇到过类似的部署问题吗?
    liyang5945
        2
    liyang5945  
       2022-12-16 13:55:20 +08:00
    这是你用的这个脚本的问题,theme-keep……这个,我用的是这个,部署 out 目录到 master 分支

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

    # 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
        8
    shmilyab  
       2022-12-17 14:55:01 +08:00
    @AsyncX 老哥,我完全新手,想问下你这个脚本要怎么配置。比如这个文件要放到哪里。要怎么改。
    sonders
        9
    sonders  
    OP
       2022-12-17 20:52:50 +08:00 via Android
    @shmilyab 没有解决呢,提了 issue ,等几天看看
    sonders
        10
    sonders  
    OP
       2022-12-17 20:53:31 +08:00 via Android
    @shmilyab 我电脑坏了,等周一给你截个图参照文件目录
    sonders
        11
    sonders  
    OP
       2022-12-17 20:54:00 +08:00 via Android
    @AsyncX 好的,回去试一下
    shmilyab
        12
    shmilyab  
       2022-12-17 21:42:36 +08:00
    @sonders 非常感谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3558 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:56 · PVG 12:56 · LAX 21:56 · JFK 00:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.