Skip to content

Commit

Permalink
add step 3
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorsector committed Jan 19, 2024
1 parent 5175596 commit e1e90b6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 28 deletions.
33 changes: 33 additions & 0 deletions .github/steps/3-add-env-to-gitignore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
<<< Author notes: Step 3 >>>
Start this step by acknowledging the previous step.
Define terms and link to docs.github.com.
TBD-step-3-notes.
-->

## Step 3: Avoiding future commits with `.env`

_Nice work removing the file from entire history of the repository! :sparkles:_

The steps we've taken so far ensure that any _new_ clones of the repository don't contain the sensitive data. But what about collaborators that may already have a copy of the repository? You should ask anyone with a copy of the repository to delete it and clone the repository fresh. In a real-life scenario, you'd also take [additional steps](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository#fully-removing-the-data-from-github) to ensure no sensitive data is cached on GitHub.com.

Now that we've mitigated the risk of exposing sensitive content, we'll be proactive and prevent its addition.

We'll now configure Git so it ignores a future addition of sensitive content by adding the filename to `.gitignore`. If someone should add it to the local copy of their repository, it will remain only on the contributor's machine and won't be pushed to GitHub.

**What is `.gitignore`?** This special file allows us to tell Git naming patterns to ignore. You can read more about it in [Ignoring files on GitHub Docs](https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files).

### :keyboard: Activity: Add `.env` to `.gitignore`

1. Locate the file we added to the repository titled `.gitignore`.
2. Add `.env` to the file.
3. Stage, commit the file:
```shell
git add .gitignore
git commit -m "ignore .env files"
```
4. Push the file to GitHub.com
```shell
git push
```
5. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
28 changes: 0 additions & 28 deletions .github/steps/3-tbd.md

This file was deleted.

0 comments on commit e1e90b6

Please sign in to comment.