FAQ - How to .gitignore

It might be important to exclude some files when uploading a project on GitHub.
An example can be the .secret file that contains the mnemonic phrase of our wallet.

Below the steps to exclude a file from GitHub.

Notice:

Once a mnemonic phrase is uploaded on GitHub, it must be considered burned and should not be used anymore. If there are funds on that wallet, make sure to move them to a safe one as soon as possible.
There are indeed bots that scan for mnemonic phrases accidentally pushed on GitHub.

How to .gitignore:


Let’s assume to have a project that has a .secret file that we do not want to push.
Open your terminal and navigate into the root folder of your project:
  • touch .gitignore

This command just created a new file called .gitignore. Now we have to edit the file so that it excludes our .secret.

Open the .gitignore file with any text editor and add .secret in it.

Schermata 2020-10-22 alle 10.58.24

You can now push your project on Github, your .secret file will be excluded.

3 Likes