In several cases you will encounter files that don't belong in the repository. Typical examples include:
- credentials (passwords, usernames, keys)
- cached files (.pyc)
Git allows users to add a .gitignore file to their top level directory to ignore these specific files
- create a file in your repository called
my_super_secret_stuff.txt
- run a
git status
and see thatmy_super_secret_stuff.txt
is untracked but can be added - create a
.gitignore
file if it does not already exist in your top level directory - at the top, add
my_super_secret_stuff.txt
to the file and save it - run a
git status
and see thatmy_super_secret_stuff.txt
doesn't show up anymore! git add
your changesgit commit
with a useful messagegit push
to the remote repository