GitHub push fails for size limit
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.
1 Comment
[ + ] Show comment
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
ur00361883
8 years ago
Top Answer
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.
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. - ur00361883 8 years ago