GitHub Actions:[远程拒绝] master -> master(不允许浅层更新),错误:推送某些引用失败。

5
在我的 Github 工作流程中,我正在检出两个存储库。随后,我将工作流程 repo“repoA”中的两个目录与 repo“repoB”合并。当推送到 repoB 时,我遇到了一个错误:
From ../repoA
 * [new branch]      master     -> workspace/master
Automatic merge went well; stopped before committing as requested
[master cbd72fe] Update
To https://github.com/username/repoB.git
 ! [remote rejected] master -> master (shallow update not allowed)
error: failed to push some refs to 'https://username@github.com/username/repoB.git'
##[error]Process completed with exit code 1.

我不明白为什么我的代码库是浅的,也不知道如何修复。这是 Github 工作流文件:

name: test
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout current repo
      uses: actions/checkout@v2
      with:
        path: repoA
    - name: Checkout other repo
      uses: actions/checkout@v2
      with:
        repository: username/repoB
        path: repoB
        token: ${{ secrets.ACCESS_TOKEN }}
    - name: Update repo
      run: | 
        cd repoB
        git remote add repoa ../repoA
        git fetch --unshallow repoa
        git config --global user.email "asd@asd.com"
        git config --global user.name "username"
        git merge -s ours --no-commit --allow-unrelated-histories repoa/master
        rm -rf webserver
        rm -rf etl
        git add .
        git read-tree --prefix=webserver -u repoa/master:serv
        git read-tree --prefix=etl -u repoa/master:misc_projects/etl
        git add .
        git commit -m "Update" -a
        git push -f https://username@github.com/username/repoB.git
1个回答

7

默认情况下,actions/checkout仅检出单个提交记录,使检出变得浅显。如果您需要所有历史记录,可以将fetch-depth输入设置为0

此处查看文档

- uses: actions/checkout@v2
  with:
    fetch-depth: 0

非常完美,谢谢!我以为参数--unshallow已经做到了这一点。 - Matthias Munz

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接