0

I have a git repo that I have created locally and established a remote. I am trying to push the local repo to the remote for the initial commit. On my first commit I got an error message like this one:

$ git push -u origin master
Counting objects: 65, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (57/57), done.
Writing objects: 100% (65/65), 177.27 MiB | 9.18 MiB/s, done.
Total 65 (delta 6), reused 0 (delta 0)
remote: Resolving deltas: 100% (6/6), done.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 47ec2ee4640f0b04863b99c53fa03943
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File test_data/SoMa_DSM.tif is 399.73 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/username/VectorAttributes.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/username/VectorAttributes.git'

I added the the folder of the problem file to the .gitignore and then cleared my cache as described in this question: Apply gitignore on an existing repository already tracking large number of files However, I got the same error again.

Using git ls-files displays, as I understand it, the files that have been committed locally and should be the only files that git is trying to push to remote. My problem file doesn't appear there but the error persists.

Why is git still trying to add that file to the remote repo even though it isn't in the local repo?

Rachel W
  • 123
  • 1
  • 11
  • Are there any existing commits that touch this file? What does `git log --stat -- test_data/SoMa_DSM.tif` say? – melpomene Oct 16 '18 at 21:43
  • Two entries come up. What do they refer to? I didn't know you could have more than one commit "touching" a file. – Rachel W Oct 16 '18 at 21:47
  • Properly speaking, a commit is a snapshot of the complete state of a repository. By "touch" I mean a commit where this file has different contents than its parent commit, i.e. a commit where the file was changed. – melpomene Oct 16 '18 at 21:50
  • I think this file is in thebrepository. So you have to delete this file from the repository. – sweting Oct 16 '18 at 22:00
  • Possible duplicate of [How to remove/delete a large file from commit history in Git repository?](https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository) – phd Oct 16 '18 at 22:19
  • https://stackoverflow.com/search?q=%5Bgit%5D+remove+huge+file+history – phd Oct 16 '18 at 22:19

2 Answers2

0

Some ideas:

  • Applying .gitignore to committed files

  • Jump to your last commit when your folder hasn't been commited (all other files could be reversed too so be careful!)

  • Make a commit where the folder is stated as 'deleted' and then push. To do this move your folder to a dir outside of your repo, delete the entry from your .gitignore file, add commit, push, move folder back add it to the .gitignore, add commit and push. Not 100% sure if it's working

NoNameHD
  • 61
  • 2
0

Did you try deleting the large folder from the repo before pushing? Try it:

git rm -r —cached FOLDER-NAME