0

I am working with an electron project and my push is declined by github due to a large file size greater than 100.0 MB. I tried using git lfs but I am still facing an error.

These commands are used:

$ git init $ cd node_modules/electron/dist $ git lfs track electron.d.ts # this is the large file $ cd - $ git add .gitattributes $ git add . $ git commit -m "First Push" $ git remote add origin "Name of my git repo" $ git push origin master 

The errors are as follow:

git push origin master Username for 'https://github.com': rCandy-Tewari Password for 'https://[email protected]': Username for 'https://github.com': Candy-Tewari Password for 'https://[email protected]': Uploading LFS objects: 100% (1/1), 529 KB | 94 KB/s, done. Enumerating objects: 4693, done. Counting objects: 100% (4693/4693), done. Delta compression using up to 4 threads Compressing objects: 100% (4451/4451), done. Writing objects: 100% (4693/4693), 69.20 MiB | 322.00 KiB/s, done. Total 4693 (delta 815), reused 0 (delta 0) remote: Resolving deltas: 100% (815/815), done. remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. remote: error: Trace: 186f2969412378dbb7e6aac9c37d1534 remote: error: See http://git.io/iEPt8g for more information. remote: error: File node_modules/electron/dist/electron is 110.07 MB; this exceeds GitHub's file size limit of 100.00 MB To https://github.com/Candy-Tewari/MediumOS--Electron-App.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://github.com/Candy-Tewari/MediumOS--Electron-App.git' 
2
  • And what's your question? Why are you tracking node_modules/ at all? Commented Mar 9, 2020 at 14:19
  • There is a file in node_modules/electron/dist/electron.d.ts whose size is greater than 100 MB because of which I am not able to push. So I saw the option of using lfs online by some googling. Commented Mar 9, 2020 at 14:28

1 Answer 1

2

Typically, node_modules dir size is very large. As the Electron official sample application does, usually we ignore node_modules/ dir in Git. (see https://github.com/electron/electron-quick-start )

So add node_modules to .gitignore. Don't worry. package.json keeps all dependencies so that you can rebuild node_modules dir by npm install command.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you. But if for any reason I have to upload a bigger file then what is the solution in those cases.
Using git lfs is correct way. And your command seems to be good. I guess the problem is that you had added the large file by git first, and tried to add it by git lfs. If so, you should git reset the file and use git lfs later.
I made another repo and tried to do everything from the beginning but it still doesn't work. Please help
hummm. It's a different problem. I recomment you to post new questtion so that you can get another answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.