Step 1: Configure Git with Your User Information
- Open a terminal (Command Prompt, Git Bash, or terminal emulator on macOS/Linux).
Configure your Git username and email address:
1 2
git config --global user.name "USERNAME" git config --global user.email "someone@email.com"
Step 2: Generate a New SSH Key
In the terminal, generate a new SSH key by running:
1
ssh-keygen
Press Enter to accept the default file location when prompted:
1
Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
Optionally, enter a passphrase for additional security, or press Enter to skip:
1 2
Enter passphrase (empty for no passphrase): Enter same passphrase again:
Step 3: Add the SSH Key to Your GitHub Account
Copy the SSH public key to your clipboard:
On macOS:
1
pbcopy < ~/.ssh/id_rsa.pub
On Windows :
1
type %USERPROFILE%\.ssh\id_rsa.pub | clip
On Windows (Only Git Bash not cmd):
1
clip < ~/.ssh/id_rsa.pub
On Linux:
1
xclip -sel clip < ~/.ssh/id_rsa.pub
- Log in to your GitHub account.
- Go to Settings by clicking your profile photo in the upper-right corner and selecting Settings.
- In the left sidebar, click SSH and GPG keys.
- Click New SSH key.
- In the “Title” field, add a descriptive label (e.g., “Personal MacBook”).
- Paste your copied SSH key into the “Key” field.
- Click Add SSH key and confirm your GitHub password if prompted.
You’re all set! You can now start committing to your repositories using SSH.
Comments powered by Disqus.