Search code examples
gitgithubbackupgit-lfs

Uploaded a large video, then used lfs which broke my GitHub page


I am facing troubles with my GitHub local repository.

This is what happened:

  1. I wanted to upload a video. So I committed and pushed using Bash.
  2. Because the video was bigger than 100 Mo, I got an error message.
  3. I deleted it, and replaced it with a smaller video (34 Mo).
  4. Already the same issue, nothing was committed (even .HTML files).
  5. So I tried git LFS for all MP4 files.
  6. Bingo, I was able to commit and to push.
  7. All videos from my GitHub page disappeared.

My questions are:
Is there a solution to bring all videos back with a line code?

I saved my local repository 1 week ago on my USB key. Can I just delete the corrupted .git local folder on my computer and paste the .git USB backup, then commit and push?

Sorry for my English and my poor level with git.

Thanks in advance.


Solution

  • You have multiple options...

    The 1st one is maybe to use the reflog git reflog to find what you think is the last good commit and reset your branch to it. Read some tutorials on how to use the reflog but it's not that complicated. For example: https://stackoverflow.com/a/22303923/717372

    If you don't find it (what I really don't expect), you could indeed plug your USB key, add the repo on the key as a remote and fetch to have the old commits again.

    Once you found them, you could reset to it also.