0

I have downloaded LFS and ran the appropriate commands to add *.mp4 files to the .gitattributes. Upon pushing, I get this error:

C:\servo>git push
Uploading LFS objects: 100% (1/1), 483 MB | 1.4 MB/s, done.
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 8 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (9/9), 461.00 MiB | 1.27 MiB/s, done.
Total 9 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 1 local object.
remote: error: Trace: adb804884f553140d5388afb59d15f48fad63e9bd5410e814cfc79929a1fda90
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File Videos/initial_testing.mp4 is 461.00 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/gabemorris12/Servo-Laser.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/gabemorris12/Servo-Laser.git'

The file is 483 MB. That shouldn't be too large. What else can I do to get this to push? The video has already been compressed to my liking.

Here were my series of commands:

git lfs track "*.mp4"

This automatically created a .gitattributes file with the text:

*.mp4 filter=lfs diff=lfs merge=lfs -text

Then I ran:

git add .
git commit -m "my message"
git push
Gabe Morris
  • 804
  • 4
  • 21
  • 1
    It says that the file size limit is 100 MB. It seems Git LFS isn't being used. – mkrieger1 Aug 05 '21 at 22:11
  • @mkrieger What about the first line in the log? *Uploading LFS objects* Any there is a .gitattributes file with the *.mp4 attached. – Gabe Morris Aug 05 '21 at 22:15
  • 1
    What exactly were the commands you used to add *.mp4 files to .gitattributes? – mkrieger1 Aug 05 '21 at 22:15
  • Oh okay, then I don't know what is wrong. – mkrieger1 Aug 05 '21 at 22:18
  • @mkrieger1 I added the commands! – Gabe Morris Aug 05 '21 at 22:21
  • If you made some *earlier* commits that store the file, those commits still exist, and still store the file. LFS includes some extra commands that destroy (well, presumably, copy and then only destroy the COPY OF—I have not used it, so caveat emptor) the original repository and all its commits and provide you with a new, different, replacement repository to use instead, in which no commit has any big file. – torek Aug 05 '21 at 23:19

2 Answers2

0

After finding this post, I was able to fix the issue. This post gave me the idea to push the .gitattributes file to the repo before trying to push the video.

I ran git reset commit_hash_before_video to go back to before the video commit and .gitattributes commit. I ran git add .gitattributes git commit -m "added .gitattributes" git push to push that file before pushing the video. Then I ran git add . git commit -m "added video" git push. The video went through.

Gabe Morris
  • 804
  • 4
  • 21
  • 2
    It's not a matter of using `git push` earlier. It's a matter of creating the `.gitattributes` file and setting up Git-LFS earlier (than committing the big file). Using `git reset`, you told your Git to stop using the old commits and start making new, different commits instead. – torek Aug 06 '21 at 13:11
0

I ran through this issue while transferring multiple files that exceeded 100 megabytes (Unreal Engine 5) to github.

For a quick solution, add to your .gitattributes file (Create it if you don't have it), this line : * filter=lfs diff=lfs merge=lfs -text

For this to work, you need to commit your .gitattributes file before committing the other big files.

El Bachir
  • 111
  • 1
  • 4