A simple .gitignore tutorial

Ever wonder how you can “hide” and prevent some local files to be uploaded to github?

Whether they are secret keys, API keys or files that are just too large…etc.

Simply use the .gitignore file to rule out some files!!

Here are some easy and fast ways to exclude files/folders!

Excluding specific files in a folder:

If you want to exclude a specific file (secret.txt), simply add the full path of the file:

File under root folder:

/secret.txt

File in a subfolder:

/secret/secret.txt

Or you could also ignore the root sign “/”

secret/secret.txt

If you want to exclude a folder, simply add the full path of the folder:

/secret/

or

secret/

Remember the path has to end with the “/” sign in the end!

Hope you find this useful, happy codin’!

Leave a Reply

Your email address will not be published. Required fields are marked *