简体   繁体   中英

Why is my local project not being pushed to github repository?

I have a node app in my local machine, which works totally fine on localhost, i have tried to push the code to github repository, if it didn't work, i created new repos and tried again

I even adopted both methods to push using git bash: using ssh and http

In my.gitignore file i have written node_modules/ But every time i get the same error message and code is not pushed to my github repo, the error is:

$ git push -u bb4 main
Enter passphrase for key '<path for ssh key>':
Enumerating objects: 2484, done.
Counting objects: 100% (2484/2484), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2457/2457), done.
Writing objects: 100% (2484/2484), 272.37 MiB | 679.00 KiB/s, done.
Total 2484 (delta 492), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (492/492), done.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 7eaa2fe7b701a22ea9b13333b122831363593fb6a0ce25c557df3aa90fa29f9e
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File mongod.pdb is 367.00 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File mongos.pdb is 247.35 MB; this exceeds GitHub's file size limit of 100.00 MB
To github.com:<username>/<reponame>.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'github.com:ritish73/bb4.git'

it shows two too large files mongod.pdb and mongos.pdb , where are these files coming from, i thought they might be in node_modules but i have already added that to.gitignore file.

There is also a.git(hidden) directory inside my project directory which is a local repo of the project handled by vscode itself, Could it be causing some issue? (though i did add this to.gitignore too, still didn't work).

What could be the problem here? Happy to hear your thoughts and resolve this error. This is my directory structure where i run git bash.

在此处输入图像描述

Clearly github doesnt allow too big files, you got that right.

You also added node_modules to your .gitignore which is good, too. You shouldnt add your .git directory, tho, since this is created when you ran git init - this directory is essential for your local git repository.

I guess that you added your node_modules in some previous commit, thus it is added in your history, meaning that the resulting diffs would be pushed to the repository.

You would have to alter these commits to exclude node_modules but for the sake of simplicity it would just create a new git repository (by deleting .git and run git init again)

There seems to be so called Github hook to deny your push, see [remote rejected] main -> main (pre-receive hook declined) error message.

Whoever initialized the repository (maybe you), set up a custom git hook to do some pre-checks before anything is pushed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM