> For the complete documentation index, see [llms.txt](https://www.macsetup.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.macsetup.xyz/dev-environment/git.md).

# Git

Git is a version control system — it tracks changes in your code and lets you collaborate safely.

To install:

```zsh
brew install git
```

Then verify if it installed correctly:

```zsh
git --version
```

#### Set Identity

Set your name and email so Git knows who is making changes. Use the same name and email as your GitHub account so your commits are properly linked.

```
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
```

These will get added to your `.gitconfig` file.

## SSH Keys <a href="#ssh-config-for-github" id="ssh-config-for-github"></a>

You can generate SSH keys for your machine by running:

```zsh
ssh-keygen
```

Then press **Enter** three times.

Navigate to:

```zsh
cd ~/.ssh
```

Type `ls -a` and you should your private key and public key

<figure><img src="https://2511323466-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LI9g4sjVwuPSMPd-qzL%2Fuploads%2FIqyIBa6xVrGhCxtsQUrn%2Fimage.png?alt=media&amp;token=6007c92f-9032-4bf0-9827-acdc483a5d2b" alt="" width="563"><figcaption></figcaption></figure>

Then type `cat id_ed25519.pub` to print your public key, so you can copy-paste it to GitHub/Bitbucket.
