Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

remote: fatal: pack exceeds maximum allowed size

# Adjust the following variables as necessary
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=500

# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
    # if so, only push the commits that are not on the remote already
    range=$REMOTE/$BRANCH..HEAD
else
    # else push all the commits
    range=HEAD
fi
# count the number of commits to push
n=$(git log --first-parent --format=format:x $range | wc -l)

# push each batch
for i in $(seq $n -$BATCH_SIZE 1); do
    # get the hash of the commit to push
    h=$(git log --first-parent --reverse --format=format:%H --skip $i -n1)
    echo "Pushing $h..."
    git push $REMOTE ${h}:refs/heads/$BRANCH
done
# push the final partial batch
git push $REMOTE HEAD:refs/heads/$BRANCH
Comment

PREVIOUS NEXT
Code Example
Shell :: git clone different ssh key 
Shell :: how to unistall dependencies 
Shell :: bash create symlink to symlinks 
Shell :: bash: rspec: command not found 
Shell :: linux awk 
Shell :: how to make new branch and switch in git 
Shell :: copy code from one repo to another git 
Shell :: ubuntu nvm 
Shell :: git clone with long file names 
Shell :: wget a file from bitbucket 
Shell :: linux mint download 
Shell :: aws cli stop rds instance 
Shell :: commit and push 
Shell :: kivy vim plugin 
Shell :: how to instal git on mac 
Shell :: where are dns entries on linux 
Shell :: C linux compiler online 
Shell :: git first time 
Shell :: ipnyb to ppt 
Shell :: linux encrypt pdf 
Shell :: bash ls and pick 2nd column 
Shell :: how to install windows service using batch file 
Shell :: heroku push alternative branch 
Shell :: exit telnet 
Shell :: chown -R www-data:www-data 
Shell :: bash parse arguments 
Shell :: check os shell liunx cygwin darwin 
Shell :: kubectl expose 
Shell :: linux "Error: Timeout was reached" 
Shell :: git checkout -f 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =