Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Remove Node Modules from Repo without local access

I was recently brought onboard a new project and browsing through I noticed the previous developer may have committed the node_modules folder by accident to the repo.

Is there a way to remove this from the repo before cloning?
I know I could delete it directly from the repo, but that seems like it may take some time.

Is there a cleaner and more effective alternative?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Edit: The repo sits on GitHub

>Solution :

Is there a way to remove this from the repo before cloning?

Yes, you can click on the node_modules directory on GitHub and then select "Delete directory" from the hamburger menu at the top right:

enter image description here

I suggest creating a new branch in GitHub before doing this. Then be sure you select that branch before navigating to the node_modules folder.

To prevent this kind of thing in the future, I suggest setting up a review process between your team members, if you work with a team. Having a second pair of eyes on code before it is added to the main branch helps catch problems like this.

You can also get "access to the repo locally" by cloning it. This actually copies the repo so you have it locally. It doesn’t give you access to the GitHub repo.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading