Steps to Install and Configure GIT (using SSH key) on MacOS - Apple Silicon
1 min readMay 1, 2023
- Install “HomeBrew” (Package Manager) — if you don't have it installed already:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
$ eval $(/opt/homebrew/bin/brew shellenv)
$ echo 'export PATH="/opt/homebrew/bin:$PATH"' >> $HOME/.zshrc
2. Install “git” using “brew”:
$ brew install git
$ git --version
3. Setup “git” with your username and email:
$ git config --global user.name "your_name"
$ git config --global user.email "your_emailID"
$ git config --global color.ui true (optional)
4. Create a public/private key pair and copy the public key to the clipboard:
$ ssh-keygen -t rsa -C "your_emailID"
$ pbcopy < ~/.ssh/id_rsa.pub
5. Configure your Github account to use this ssh key
- Go to https://github.com/settings/profile
- Select “SSH and GPG keys” -> “new SSH key”
- Paste the public key that you copied to your clipboard in the “Key” section
6. You can login to “git” from Mac Terminal:
ssh -T git@github.com
Expected Output :
Hi TheLearnLoop! You've successfully authenticated, but GitHub does not provide shell access.