I am currently working on a GitHub Action that saves my repository to AWS CodeCommit. It looks like this:
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "checkout"
uses: actions/checkout@v2
- name: "add aws codecommit remote"
run: ...
- name: "push repository to aws codecommit"
run: |
git fetch --tags
git fetch --all
git push aws --force --all
git push aws --tags
This action works well, but you can break it by doing the following:
Now I get the following error:
error: remote unpack failed: Unknown commit XXXX
To https://git-codecommit.my-region-1.amazonaws.com/v1/repos/***
! [remote rejected] feature/b -> feature/b (unpacker error)
error: failed to push some refs to 'https://git-codecommit.my-region-1.amazonaws.com/v1/repos/***'
Error: Process completed with exit code 1.
Funnily, it works if I perform the exact same steps on my local machine. I have checked many possible solutions to these problems, but they all suggest a force push or permission problems, which just isn't the case. I tried these solutions anyway, but nothing worked.
Does anyone have a tip for me?
Cheers and thank you in advance!
When using the action/checkout
, you need to add the fetch-depth:0
variable if you wish to fetch all history: reference.
steps:
- name: "checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0