Home > Enterprise >  How to setup gitignore in root folder
How to setup gitignore in root folder

Time:10-28

I have a fullstack project I want to push to github. Root folder with server and client folder. I don't want to have 2 separate gitignore files in server and client. I just want to add it to root. When i did, its not ignoring any of the files.

node_modules/
.env/
yarn.*
.DS_Store

CodePudding user response:

you should separate project directory into server code and client code.

src/
src/server
src/client

and make .gitignore for server and client

src/server/.gitignore
src/client/.gitignore

at last, you can extract shared gitignore into root src dir

src/.gitignore

CodePudding user response:

Try do like this

**/node_modules
**/.env

it says the file is in any folder, with that name. so all files/folders named node_modules and .env will be ignored.

put the .gitignore in the root folder with the client and server folders

  • Related