Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I stop Git from trying to push non-existent file?

Tags:

git

github

push

When trying to push, I get a fatal error because git is trying to include a file that is too large for GitHub. git rm file fails because the file doesn't exist (it has existed, but no longer does). Git seems to refuse to acknowledge that the file is gone.

What should I do?


For information, the error message I get is:

remote: error: GH001: Large files detected.
remote: error: Trace: dbbfb79f51f133c90dfd58730a4ab624
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File [filename] is 385.65 MB; this exceeds GitHub's file size limit of 100 MB
To https://github.com/[---].git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/[---].git'

If the above is as impossible to achieve as it seems, instructions on how to just torch all the git related stuff here and set it up from scratch with code that we have preserved in backup directories would be great. We really don't have time to mess around with git anymore...

like image 588
gibson Avatar asked Dec 16 '14 16:12

gibson


People also ask

How do I stop git push?

The trick to prevent accidentally pushing in-development changes to the wrong environment is to use the git command for changing remote's URL. By adding the --push flag to the command, only the push URL is manipulated. So it is still possible to pull from that remote.

How do I not push files to GitHub?

Use your favorite text editor to open the file called . git/info/exclude within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.

What happens if you cancel a git push?

The upstream Git repository will be oblivious to your attempted push, and no change will occur upstream.


1 Answers

Run git rm --cached file even if the file does not exist anymore. This way, the file will be removed from the index.

If you are looking to completely eradicating the file from Git history, you will need some git filter-branch-fu instead.

like image 100
Stefano Sanfilippo Avatar answered Oct 28 '22 06:10

Stefano Sanfilippo