0

I started am R.project and made 5 commits locally. I went to push to github, but have the following errors:

remote: error: Trace: 0f04f657da56cd2cf86526f44eae8995d1ae359b6e251f112da0794686a722e3 remote: error: See http://git.io/iEPt8g for more information. remote: error: File data/v-2021/AIRS.2006.12.31.L3.RetStd001.v6.0.9.0.G13155192744.hdf is 380.41 MB; thisexceeds GitHub's file size limit of 100.00 MB remote: error: GH001: Large files detected. You may want to try Git Large File Storage -

I don't actually want this file backed up so I added *.hdf to .gitignore and ran

git rm --cached *.hdf

Having confirmed this because it is still associated with the previous commits I tried

git filter-branch --tree-filter 'rm -f *.hdf' HEAD

but get the same errors

I have also tried

git rebase -i HEAD~2

but I think I got the interactive part wrong and it deleted my code back 3 commits, so now it freaks me out. (yes I do have a backup)

Is there a way I can remove this file from being tracked in my previous, local commits so I can push to github in a Newb-friendly way?

The_Tams
  • 205
  • 1
  • 10
  • 1
    You're right that it's because it's associated with previous commits! This answer here seem like what you want to do, and it allows you to do it without installing any other tools! Good luck! https://stackoverflow.com/a/30274113/4967403 – Alecto Irene Perez Nov 19 '21 at 23:19
  • 1
    Alternatively, if you're willing to install something, git filter-repo is a tool designed to do this job. The installation looks pretty simple, and once it's installed you should be able to do this with `git filter-repo --invert-paths --path-match `. More details are provided in the original answer here: https://stackoverflow.com/a/61602985/4967403 the install process is also described here, but there's a chance it's already on your system! https://github.com/newren/git-filter-repo/blob/main/INSTALL.md – Alecto Irene Perez Nov 19 '21 at 23:26
  • I had not found those, but I am struggling to apply those solutions to mine. I tried: git filter-branch --tree-filter 'rm -f *.hdf' HEAD but get the same errors. I had also tried to work with git rebase -i but don't understand it. I made a mess of it and it deleted half my code, so now it freaks me out. – The_Tams Nov 19 '21 at 23:41
  • Since you're trying to remove all hdf files from git, try --path-glob instead of path-match: `git filter-repo --invert-paths --path-glob '*.hdf'` You need to use the single quotes around `'*.hdf'` to pass it verbatim to the command. – Alecto Irene Perez Nov 20 '21 at 00:45
  • 1
    Also make a backup of the hdf files if you don't want to lose them – Alecto Irene Perez Nov 20 '21 at 00:48
  • As I was unsure whether --path-glob would get rid of all .hdf files from other .git projects, and because of the specifics of this situation (there were no commits pushed to github yet and all my code is thoroughly documented as an Rnotebook -code lab book of sorts), the easiest solution was to unhide and delete the .git folder and initialise a new one which I was then able to push to my github repo. Although it didn't work out for me in this instance, thank you for your advice @Alecto Irene Perez – The_Tams Nov 23 '21 at 09:49
  • 1
    It will only get rid of files in the repository you run it in. I'm sorry we weren't able to keep your commits, but I'm happy you were still able to find a solution! – Alecto Irene Perez Nov 23 '21 at 18:17
  • 1
    OK, thats really good to know for if I am daft in the same way again! – The_Tams Nov 24 '21 at 14:20
  • Good luck with your work! – Alecto Irene Perez Nov 24 '21 at 18:18

0 Answers0