Git is committing node_modules despite being ignored [duplicate] - node.js

This question already has answers here:
Make the current commit the only (initial) commit in a Git repository?
(17 answers)
Closed 2 years ago.
One of the dependencies in my project uses chromium (which is over 100mb) and makes github throw an error when trying to push it.
To solve this, I made sure to ignore my node_modules folder.
However I still get the error when I try to push.
Here is my .gitignore file:
.env
node_modules
node_modules/*
Here's the output of git ls-tree -r master --name-only:
.DS_Store
.gitignore
README.md
app.js
package-lock.json
package.json
public/index.html
public/sign-in-with-twitter.png
public/styles.css
server.js
utils/.DS_Store
utils/database.js
utils/encryption.js
utils/gradients.js
utils/increments.js
utils/twitter.js
And here's the full error when trying to push:
remote: D, [2020-09-16T12:48:02.974268 #49478] DEBUG -- : FAILBOT EXCEPTION: action=processing exception=NoMethodError original_type: GitHub::PreReceiveBlob::PushRejected data={"release"=>"6507d92df20b3ea50e34effb905bb46f3d94cc3d", "current_ref"=>"train-b4ab8774", "app"=>"github-user", "ruby"=>"ruby 2.7.1p92 (2020-07-11 revision 4ec8c70524) [x86_64-linux]", "server"=>"github-dfs-08e6617.va3-iad.github.net", "deployed_to"=>"production", "kube_namespace"=>"unknown", "pusher"=>"gb221", "proto"=>"ssh", "path"=>"/data/repositories/7/nw/79/2e/61/297891227/295655929.git", "from"=>"hooks/pre-receive.rb.rb [gb221/gradient-twitter.git]", "audit_msg"=>"{ \"above_lock_quota\":false, \"above_warn_quota\":false, \"babeld\":\"61941ce7\", \"babeld_proto\":\"ssh\", \"check_lfs_integrity\":false, \"cmdline\":\"/usr/lib/git-core/git receive-pack .\", \"committer_date\":\"1600285604 -0700\", \"disable_hooks\":true, \"features\":\" report-status side-band-64k agent=git/2.22.0\", \"frontend\":\"unicorn-gitauth-api-654b85c97f-s5c4m\", \"frontend_pid\":133, \"frontend_ppid\":6, \"git_dir\":\"/data/repositories/7/nw/79/2e/61/297891227/295655929.git\", \"git_dir_safe\":\"/data/repositories/7/nw/79/2e/61/297891227/295655929.git\", \"gitauth_version\":\"6507d92d\", \"hostname\":\"github-dfs-08e6617.va3-iad.github.net\", \"pgroup\":\"64872\", \"pid\":64872, \"ppid\":64848, \"program\":\"receive-pack\", \"proxy_pre_fetch_and_detect_have_present\":false, \"pubkey_creator_id\":18144602, \"pubkey_creator_login\":\"gb221\", \"pubkey_fingerprint\":\"75:cb:2d:06:a1:8a:34:db:b7:cf:27:8d:2d:f8:15:90\", \"pubkey_id\":46204985, \"pubkey_verifier_id\":18144602, \"pubkey_verifier_login\":\"gb221\", \"quotas_enabled\":true, \"real_ip\":\"86.146.63.195\", \"received_objects\":2909, \"remote_addr\":\"10.56.111.46\", \"remote_port\":\"54238\", \"repo_config\":\"{\\\"allow_auto_deleting_branches\\\":\\\"false\\\",\\\"dependency_vulnerability_alerts.disabled\\\":\\\"true\\\",\\\"repository_dependency_updates.vulnerabilities.disabled\\\":\\\"true\\\",\\\"tiered_reporting\\\":\\\"false\\\"}\", \"repo_id\":295655929, \"repo_name\":\"gb221/gradient-twitter\", \"repo_public\":false, \"request_id\":\"fccb4e4a60b223744cc60e177b626e75\", \"status\":\"pre_receive_hook\", \"use_http_postrx\":true, \"user_id\":18144602, \"user_login\":\"gb221\", \"user_operator_mode\":false }", "env"=>"production", "error_code"=>"45a2d52ef1b728ec2c1124abf968e3d6", "exception_detail"=>[{"type"=>"GitHub::PreReceiveBlob::PushRejected", "value"=>"GitHub::PreReceiveBlob::PushRejected", "stacktrace"=>[]}], "created_at"=>"2020-09-16T19:48:02.973358Z", "refs"=>"refs/heads/master: 0dbd850362f939fe02d2e656912a42fdebb32eff", "files"=>"node_modules/svg-to-img/node_modules/puppeteer/.local-chromium/mac-536395/chrome-mac/Chromium.app/Contents/Versions/66.0.3347.0/Chromium Framework.framework/Versions/A/Chromium Framework: 125274684 bytes", "repo_id"=>295655929, "rollup"=>"2a7bc1e29623942867c40e965f833e13"}
remote: D, [2020-09-16T12:48:02.974312 #49478] DEBUG -- : GitHub::PreReceiveBlob::PushRejected
remote: D, [2020-09-16T12:48:02.975337 #49478] DEBUG -- : undefined method `hour' for 1:Integer
remote: D, [2020-09-16T12:48:02.975391 #49478] DEBUG -- : /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/lib/github/config/failbot.rb:86:in `block in <top (required)>'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/vendor/gems/2.7.1/ruby/2.7.0/gems/failbot-2.5.5/lib/failbot.rb:345:in `report!'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/vendor/gems/2.7.1/ruby/2.7.0/gems/failbot-2.5.5/lib/failbot.rb:322:in `report'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/lib/github/githooks/pre_receive_blob.rb:75:in `check'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/lib/github/githooks/push_context.rb:40:in `block (2 levels) in check'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/vendor/gems/2.7.1/ruby/2.7.0/gems/dogstatsd-ruby-4.1.0/lib/datadog/statsd.rb:356:in `time'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/lib/github/githooks/push_context.rb:39:in `block in check'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/lib/github/githooks/push_context.rb:34:in `each'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/lib/github/githooks/push_context.rb:34:in `check'
remote: hooks/pre-receive.rb:52:in `block in <main>'
remote: /data/github/releases/20200916185747-6507d92df20b3ea50e34effb905bb46f3d94cc3d/vendor/gems/2.7.1/ruby/2.7.0/gems/dogstatsd-ruby-4.1.0/lib/datadog/statsd.rb:356:in `time'
remote: hooks/pre-receive.rb:51:in `<main>'
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 45a2d52ef1b728ec2c1124abf968e3d6
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File node_modules/svg-to-img/node_modules/puppeteer/.local-chromium/mac-536395/chrome-mac/Chromium.app/Contents/Versions/66.0.3347.0/Chromium Framework.framework/Versions/A/Chromium Framework is 119.47 MB; this exceeds GitHub's file size limit of 100.00 MB
To github.com:gb221/gradient-twitter.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#github.com:gb221/gradient-twitter.git'
I've tried clearing all tracked files and re-adding everything (as described here) but that doesn't work.

I ended up solving it by removing all historic commits.
For those also in the same position I followed this.

Related

Unable to push code to fresh Dokku container: unable to apply apparmor profile: apparmor failed to apply profile

On my server I installed dokku and created a new App: myNodeApp
$ dokku apps:create myNodeApp
On my local repo I added the dokku remote and want now to push the existing code to my container, after git add . :
$ git push dokku main
Enumerating objects: 1119, done.
Counting objects: 100% (1119/1119), done.
Delta compression using up to 20 threads
Compressing objects: 100% (760/760), done.
Writing objects: 100% (1119/1119), 92.80 MiB | 11.25 MiB/s, done.
Total 1119 (delta 577), reused 727 (delta 310), pack-reused 0
remote: Resolving deltas: 100% (577/577), done.
-----> Set main to DOKKU_DEPLOY_BRANCH.
-----> Cleaning up...
-----> Building myNodeApp from herokuish
remote: time="2023-02-18T21:02:28Z" level=error msg="error waiting for container: "
remote: docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: unable to apply apparmor profile: apparmor failed to apply profile: write /proc/self/attr/apparmor/exec: no such file or directory: unknown.
remote: ! Failure extracting app code
remote: ! Removing invalid image tag dokku/myNodeApp:latest
remote: ! App build failed
To serversIP:myNodeApp
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'serversIP:myNodeApp'
(base)
This is a Docker issue. Docker v23 accidentally added a hard dependency on AppArmor, and v23.0.1 implemented an incorrect fix, changing the error message to the one you encountered.
For the moment, the fix is one of:
a) Downgrade Docker to below v23
b) Install the apparmor package (I also had to reboot)
c) Wait for the issue for the new error to get fixed

Deployment on heroku failed

I want to deploy my exiting project on heroku, but it gives me an error.
structure of my file:
___instagram
__backend
_controllers
_images
_middleware
_models
_node_modules
_routes
_utiles
.gitignore
app.js
package-lock.json
package.json
Procfile
__ui
...
commands:
E:\Coding\projects\instagram>git add .
E:\Coding\projects\instagram>git commit -m "update controllers"
[master 086d891] update controllers
1 file changed, 1 insertion(+), 1 deletion(-)
E:\Coding\projects\instagram>cd backend
E:\Coding\projects\instagram\backend>git push -f heroku master
after the last command (git push -f heroku master) i got this error:
E:\Coding\projects\instagram\backend>git push -f heroku master
Enumerating objects: 16, done.
Counting objects: 100% (16/16), done.
Delta compression using up to 4 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (10/10), 956 bytes | 956.00 KiB/s, done.
Total 10 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz
remote:
remote: ! ERROR: Application not supported by 'heroku/nodejs' buildpack
remote: !
remote: ! The 'heroku/nodejs' buildpack is set on this application, but was
remote: ! unable to detect a Node.js codebase.
remote: ! A Node.js app on Heroku requires a 'package.json' at the root of
remote: ! the directory structure.
remote: !
remote: ! If you are trying to deploy a Node.js application, ensure that this
remote: ! file is present at the top level directory. This directory has the
remote: ! following files:
remote: !
remote: ! backend/
remote: ! ui/
remote: !
remote: ! If you are trying to deploy an application written in another
remote: ! language, you need to change the list of buildpacks set on your
remote: ! Heroku app using the 'heroku buildpacks' command.
remote: !
remote: ! For more information, refer to the following documentation:
remote: ! https://devcenter.heroku.com/articles/buildpacks
remote: ! https://devcenter.heroku.com/articles/nodejs-support#activation
remote:
remote:
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to ins-app-clone.
remote:
To https://git.heroku.com/ins-app-clone.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/ins-app-clone.git'
Heroku buildpack looks at the top-level (root) for package.json.
The solution here is to use git sub-trees. I too was facing this issue where I had a Monorepo MERN codebase in which I wanted to deploy my server using Heroku and client via Vercel.
I have written a blog post regarding this, I'm sure you'll get an idea regarding a solution to this.
Link to Blog Post

heroku/python buildpack for node.js app get rejected

I have an Node.js app with Python scripts that I am trying to deploy to Heroku.
Every time I try to add the heroku/python buildpack the git push gets rejected.
remote: Could not find a version that satisfies the requirement pywin32==224 (from -r /tmp/build_ebad00f3b8d3c9b4b03965f0d0924e7a/requirements.txt (line 57)) (from versions: )
remote: No matching distribution found for pywin32==224 (from -r /tmp/build_ebad00f3b8d3c9b4b03965f0d0924e7a/requirements.txt (line 57))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to XXXXXX
remote:
To https://git.heroku.com/xxxxxx.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/xxxxx.git'
Without the heroku/python buildpack the push works fine. I think I need that buildback for my Python scripts work on web.
My app runs fine locally but everything related to Python is not working when deployed. I use Python 3.7.3 64-bit version.
I have runtime.txt and requirements.txt in root of my app.
My runtime.txt file:
python-3.7.3
requirements.txt:
altgraph==0.16.1
asn1crypto==0.24.0
astroid==2.1.0
awscli==1.16.209
beautifulsoup4==4.6.3
botocore==1.12.199
bs4==0.0.1
cached-property==1.5.1
cachetools==3.1.1
certifi==2019.6.16
cffi==1.12.2
chardet==3.0.4
colorama==0.3.9
cryptography==2.6.1
defusedxml==0.5.0
dnspython==1.16.0
docutils==0.14
et-xmlfile==1.0.1
exchangelib==1.12.2
future==0.17.1
google-api-python-client==1.7.9
google-auth==1.6.3
google-auth-httplib2==0.0.3
google-auth-oauthlib==0.4.0
googletrans==2.4.0
gspread==3.1.0
httplib2==0.13.0
idna==2.8
isodate==0.6.0
isort==4.3.4
jdcal==1.4
jmespath==0.9.4
lazy-object-proxy==1.3.1
lxml==4.3.2
macholib==1.11
mccabe==0.6.1
ntlm-auth==1.2.0
numpy==1.15.4
oauth2client==4.1.3
oauthlib==3.0.1
openpyxl==2.6.0
pandas==0.23.4
pefile==2018.8.8
py2exe==0.9.2.2
pyasn1==0.4.5
pyasn1-modules==0.2.5
pycparser==2.19
Pygments==2.3.1
pygsheets==2.0.1
PyInstaller==3.4
pylint==2.2.2
PyMySQL==0.9.3
pyodbc==4.0.26
PySocks==1.6.8
python-dateutil==2.7.5
pytz==2019.1
pywin32==224
pywin32-ctypes==0.2.0
pywinrm==0.3.0
PyYAML==5.1
requests==2.22.0
requests-kerberos==0.12.0
requests-ntlm==1.1.0
requests-oauthlib==1.2.0
rsa==3.4.2
s3transfer==0.2.1
selenium==3.141.0
six==1.11.0
soupsieve==1.8
stem==1.7.0
torrequest==0.1.0
tzlocal==1.5.1
uritemplate==3.0.0
urllib3==1.25.3
uuid==1.30
virtualenv==16.7.2
winkerberos==0.7.0
wrapt==1.10.11
xlrd==1.1.0
XlsxWriter==1.1.2
xmltodict==0.12.0
Appreciate any guidance.
Here's the problem:
Could not find a version that satisfies the requirement pywin32==224
Heroku doesn't run Windows, so pywin32 isn't available. I'm not sure what you're using that for. If you don't need it, remove it (along with pywin32-ctypes, pywinrm, and anything else that's Windows-dependent) then redeploy. If you're using those libraries you'll need to rewrite that portion of your code.
Generally speaking, your requirements.txt should only have things your application actually needs. I suspect that you've got a lot of things in there that you're not using. Maybe you're not using virtual environments?

Running Python Worker on Heroku - Push Failed

my scope is to run a python script (it does scrap text from websites and save it in csv files) in the cloud through cron job.
For this I chose Heroku.
I am stuck because when I try to deploy the worker I get a Push rejection.
Here is what i do:
I put my scrapit.py and Procfile ('worker: node scrapit.py') in a directory.
Then after I create an app in heroku, I send the following commands from the directory of above:
$ heroku login
$ git init
$ heroku git:remote -a app-name-on-heroku
$ git add .
$ git commit -am "nth time :("
$ git push heroku master
I get the following message:
Counting objects: 41, done. Delta compression using up to 4 threads.
Compressing objects: 100% (36/36), done. Writing objects: 100%
(41/41), 12.97 KiB | 0 bytes/s, done. Total 41 (delta 6), reused 0
(delta 0) remote: Compressing source files... done. remote: Building
source: remote: remote: -----> App not compatible with buildpack:
https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info:
https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: remote: ! Push failed remote: Verifying deploy...
remote: remote: ! Push rejected to app-name-on-heroku. remote: To
https://git.heroku.com/app-name-on-heroku.git ! [remote rejected]
master -> master (pre-receive hook declined) error: failed to push
some refs to 'https://git.heroku.com/app-name-on-heroku.git'
after the error I sent this command:
heroku buildpacks:set heroku/python
but still the push gets rejected
Every Heroku buildpack specifies a bin/detect file, which lets the platform know if that buildpack can be used with that app or not.
The python buildpack requires either: requirements.txt, setup.py or Pipfile to be present.
You need to create (and properly configure) one of those files to be able to have your python app built.

OpenShift/nodejs: Failed to execute: 'control start'

After I do git push I receive the following error:
remote: Activation failed for the following gears:
remote: 57af58352d52718047000135 (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/57af58352d52718047000135/nodejs
remote: #<IO:0x00000001e5a2d0>
remote: #<IO:0x00000001e5a258>
The previous responses to this question all say to try again, but that's not working so maybe it's something I'm doing? I'm not even sure where to start to fix this.

Resources