GitHub question: pushing Angular application

Hello everybody,

I’m new to GitHub and I’m little confused as to which Angular folders/files to push to GitHub.

I know how to push the entire directory/file; mine is called projectone, to GitHub but based on some of the Angular GitHub repository the folder “node_module” isn’t part of the push. so, how do i exclude the node_module folder or is this something automatically done?

the commands to push the project to GitHub is the way I understand is:
change to the project folder: projectone
git add . (dot indicates everything within the current folder)
git commit -m “description”
git push
this should do the trick but I’m assuming i dont need to push the node_moudle so how do i exclude this folder?

1 Like

You need to use a gitignore file. As the name suggests, this tells git which files to ignore when making a commit.

You are correct that you shouldn’t commit your node_modules folder. This is often many megabytes in size and can be recreated by anyone cloning your repo by running npm i on their machine.

The way to ignore it is to create a file called .gitignore in the root of your project. Note the dot at the beginning of the file name. This will cause the file to be hidden on Mac/Linux. It might also cause Windows to throw up its hands and refuse to cooperate (no idea).

In the .gitignore file, place

node_modules/

Then you can make your commit while ignoring the node_modules folder. It’s probably a good idea to make sure there is nothing staged before you do this. You can do that with git reset. You can also run git status to see what is currently staged.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.