Github操作:[远程拒绝]主->主服务器(不允许进行浅更新),错误:无法推送某些裁判 [英] Github Actions: [remote rejected] master -> master (shallow update not allowed), error: failed to push some refs

查看:231
本文介绍了Github操作:[远程拒绝]主->主服务器(不允许进行浅更新),错误:无法推送某些裁判的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Github工作流程中,我正在检查两个存储库.随后,我将工作流存储库"repoA"的两个目录与​​存储库"repoB"合并.推送到repoB时,出现错误:

In my Github workflow, I am checking out two repositories. Subsequently I merge two directories of the workflow repo "repoA" with repo "repoB". When pushing to repoB, I get an error:

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工作流程文件:

I don't understand why my repo is shallow and how to fix it. The Github workflow file:

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

推荐答案

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

By default actions/checkout only checks out a single commit, making the checkout shallow. If you want all history you can set the fetch-depth input to 0.

请参见文档此处.

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

这篇关于Github操作:[远程拒绝]主->主服务器(不允许进行浅更新),错误:无法推送某些裁判的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆