Once git is installed, you can configure git by using your GitHub username and email address
3. Set up credentials
To connect to GitHub via SSH, you will need to:
Create new SSH key
Add SSH key to GitHub account
Check for existing SSH key
Before generating new SSH key, verify if you already have one.
Open Git Bash, then:
Check if you have the following files by default
id_rsa.pub
id_ecdsa.pub
id_ed25519.pub
Create a new SSH key
Run the following commands in your bash
Add SSH key to ssh-agent
Run the following commands in your bash
Add new SSH key to your GitHub account
Run the following commands in your bash
this will copy your SSH Key to keypad, go to settings of your GitHub profile -> in the "Access" section on the sidebar, go to SSH and GPG keys -> New SSH Key or Add SSH key ->give a title & paste your previously copied key into the "Key" field.
4. Personal access token
In the upper-right corner of any page, click your profile photo, then click Settings.
In the left sidebar, click Developer settings.
In the left sidebar, under Personal access tokens, click Tokens (classic)
Click Generate new token.
Under Token name, enter a name for the token.
Under Expiration, select an expiration for the token.
Give your token a descriptive name.
Select the scopes you'd like to grant this token. You can select:
repo & everything under repo
admin:repo_hook & everything under repo
delete_repo
Click Generate token.
Make sure to copy & store this token safely. When you first configure your project, you will be asked for Username & Password as shown below. This is where you will use your token
$ ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
$ ssh-keygen -t ed25519 -C "your_email@example.com"
> Generating public/private ALGORITHM key pair.
# either set passphrase or leave it blank
> press enter
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ open ~/.ssh/config
> The file /Users/YOU/.ssh/config does not exist.
$ touch ~/.ssh/config
$ nano ~/.ssh/config
## paste the following in the config file
Host github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
$ ssh-add --apple-use-keychain ~/.ssh/id_ed25519