Best Practices Question

GitHub push fails for size limit

09/01/2016 1240 views
I am trying to migrate a private repository to a github public repository as per my project requirement.

Initially, the git repository is in internal github servers, so there is no size limit.

But now, when I am pushing the repository to public.I am getting error as size limit 100 MB crossed as there is a zip file which is 325 MB.
When I deleted the file from repo and commited it still I am getting the error.

This is because it will be there in previous commits and other branches.

I tried to remove that using 

 git filter-branch -f --tree-filter 'rm -f upgrade.zip' HEAD --all

and also without --all option.

But still I am getting the same error.

Could you please suggest me how to proceed.
And also I need to replace the zip with its contents extracted in the folder with name of the zip.And also the zip file is in internal folder.When I delete it , the parent folder also getting deleted.

For migrating I followed below steps.
git clone repo_url
git remote set-url origin new_url
git push origin master
then for every  branch...
git checkout -b branch_name
git push origin branch_name
Please let me know if any corrections in above commands also.
Answer Summary:
1 Comment   [ + ] Show comment


  • with below command I am able to delete the file everywhere in the particular branch in the repository.
    git filter-branch -f --tree-filter 'rm -f upgrade.zip' HEAD
    But my requirement is to add the extracted folder upgrade to all the commits in that branch.

Answer Chosen by the Author

I got the solution for this.

If we call below command, it will delete the file from all the commits in the current checked out branch.
git filter-branch -f --tree-filter 'rm -f upgrade.zip' HEAD 

Someone suggested me to use --all for all the branches, I tried --all and -all but none of them are working.
As my requirement is to remove the zip and also to replace it with the extracted folder, I created an exe using AutoIT to do this stuff.It will use the 7zip in the background.

Below is the code.
; *** Start added by AutoIt3Wrapper ***#include <FileConstants.au3>#include <MsgBoxConstants.au3>#include <TrayConstants.au3>#include <Array.au3>#include <File.au3>#include<WinAPIFiles.au3>$sFilePath = @WorkingDir & "\" & $CmdLine[1]$sFolder = StringTrimRight($sFilePath, 4)$7z = "C:\7z\7za x """ & $sFilePath & """ -o"""&$sFolder&"""";@WorkingDir & "\" &"upgrade";MsgBox(0,"",$7z)RunWait($7z);MsgBox(0,"",$7z)FileDelete($sFilePath)#cs$hFileOpen = FileOpen("C:\Users\kirud01\Desktop\UnZipGITlog.log",$FO_APPEND)FileWriteLine($hFileOpen,$7z)FileWriteLine($hFileOpen,$iDelete)FileClose($hFileOpen)#ce

After compiling this, I am running below command for a branch.
git filter-branch -f --tree-filter '/c/GIT/GitMigration/working/delete.exe "Ancillary Files/InstallationRoot/Upgrade.zip"' HEAD
And once completed , I am checking out other branches and running the above command.

git checkout -b New_Branch origin/New_Branch

This might not be the best way to do the work, but I got only this.

The Code is available in the GitHub

If you know any better solution, please let me know.

Answered 09/09/2016 by: ur00361883
Black Belt

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ