Last active
December 28, 2022 13:39
-
-
Save RubenKelevra/5efe0cf240dc02226784d4fd64f8ec6a to your computer and use it in GitHub Desktop.
Github only accepts pushes up to 2 GB as they are bundled into a single pack - this allows for a partial push via `git partial-push origin branchname` after placing it into .gitconfig. Error message"remote: fatal: pack exceeds maximum allowed size (2.00 GiB) error: remote unpack failed: index-pack abnormal exit"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
partial-push = "!sh -c | |
'REMOTE=$0;BRANCH=$1;BATCH_SIZE=100; | |
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then | |
range=$REMOTE/$BRANCH..HEAD; | |
else | |
range=HEAD; | |
fi; | |
n=$(git log --first-parent --format=format:x $range | wc -l); | |
echo "Have to push $n packages in range of $range"; | |
for i in $(seq $n -$BATCH_SIZE 1); do | |
h=$(git log --first-parent --reverse --format=format:%H --skip $i -n1); | |
echo "Pushing $h..."; | |
git push $REMOTE ${h}:refs/heads/$BRANCH; | |
done; | |
git push $REMOTE HEAD:refs/heads/$BRANCH' | |
" | |
# Author: Crt Mori on stackoverflow.com | |
# Source: https://stackoverflow.com/a/72977369 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment