Home > Software design >  Remove Node Modules from Repo without local access
Remove Node Modules from Repo without local access

Time:04-07

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?

Edit: The repo sits on GitHub

CodePudding user response:

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.

  • Related