Adding untracked file to GitHub

I keep passwords, etc, in an untracked file in my local repo in a file called

I want to add an untracked stub to the remote repo on github so that the code will run and fall back gracefully.

How do I add an untracked file to GitHub? It seems like the only way to add a file on the GitHub web site is to use a commit, which I think means the file is tracked, whatever the .gitignore file says.

Exactly. If you want to gracefully handle your secrets file not being present, the best way to do it is to make loading it optional. The name kind of sounds like you use it as a Python module, in that case you could catch the ImportError that occurs if it is missing.

Thank you! That’s an excellent idea. I have a hard time remembering that in Python imports are executable statements.

1 Like