[英]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我的本地机器上有一个节点应用程序,它在本地主机上运行良好,我尝试将代码推送到 github 存储库,如果它不起作用,我创建了新的存储库并再次尝试
I even adopted both methods to push using git bash: using ssh and http我什至采用了两种方法来推送使用 git bash:使用 ssh 和 Z80791B3AE7002CB88C246788
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:在 my.gitignore 文件中,我编写了 node_modules/ 但是每次我收到相同的错误消息并且代码没有推送到我的 github 存储库时,错误是:
$ 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.它显示了两个太大的文件mongod.pdb和mongos.pdb ,这些文件来自哪里,我认为它们可能在 node_modules 中,但我已经将其添加到 .gitignore 文件中。
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?我的项目目录中还有一个 .git(hidden) 目录,它是由 vscode 本身处理的项目的本地 repo,它会引起一些问题吗? (though i did add this to.gitignore too, still didn't work).
(虽然我也将它添加到.gitignore,但仍然没有工作)。
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.
这是我运行 git bash 的目录结构。
Clearly github doesnt allow too big files, you got that right.显然 github 不允许太大的文件,你说得对。
You also added node_modules
to your .gitignore
which is good, too.您还将
node_modules
添加到您的.gitignore
中,这也很好。 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.你不应该添加你的
.git
目录,因为这是在你运行git init
时创建的——这个目录对于你的本地 git 存储库是必不可少的。
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.我猜您在之前的某个提交中添加了
node_modules
,因此它已添加到您的历史记录中,这意味着生成的差异将被推送到存储库。
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)您必须更改这些提交以排除
node_modules
但为简单起见,它只会创建一个新的 git 存储库(通过删除.git
并再次运行git init
)
There seems to be so called Github hook to deny your push, see [remote rejected] main -> main (pre-receive hook declined)
error message.似乎有所谓的 Github 挂钩拒绝您的推送,请参阅
[remote rejected] main -> main (pre-receive hook declined)
错误消息。
Whoever initialized the repository (maybe you), set up a custom git hook to do some pre-checks before anything is pushed.无论是谁初始化了存储库(也许是你),设置一个自定义的 git 挂钩,以便在推送任何内容之前进行一些预检查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.