Creating SSH Key
In Windows terminal or git bash, create ssh key using the following command
1
ssh-keygen -t ed25519 -C "your_email@example.com"
If you want to specify a path and a filename, you can use
1
ssh-keygen -t ed25519 -C "your_email@example.com" -f "path"
You can simply create in current directory like below
1
ssh-keygen -t ed25519 -C "your_email@example.com" -f "your_username"
Registering SSH Key to git
Add ssh key using the command below.
1
ssh-add /path/to/your_key
Verify that it is successfully added.
1
ssh-add -l
If you are using git bash you should do the above in window terminal and have to connect bash’s ssh with the windows ssh.
1
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
Setting config of repo
You will have to specify which account you are going to use for the repo each time you clone or create new repo.
You can set a global config, but you should still do this if you want to use different account.
1
2
git config user.name your_username
git config user.email your_email@example.com
Additional : How to set signing key
Open terminal, and type
1
2
3
4
5
git config --global commit.gpgsign true
git config --global gpg.format ssh
git config --global user.signingkey /PATH/TO/.SSH/KEY.PUB
You can use the same ssh key as signing key.