31 lines
733 B
Markdown
31 lines
733 B
Markdown
# Git SSH Config
|
|
|
|
When using SSH to connect to a remote repository, you can configure your SSH client to use a specific key for a specific host. This is useful when you have multiple keys and want to use a specific key for a specific host.
|
|
|
|
Sample configuration is below
|
|
|
|
```bash
|
|
# ~/.ssh/config
|
|
Host github.com
|
|
HostName github.com
|
|
User git
|
|
IdentityFile ~/.ssh/my-github-key
|
|
PreferredAuthentications publickey
|
|
```
|
|
|
|
## Generate SSH Key
|
|
|
|
Use the following to generate a new SSH key:
|
|
|
|
```bash
|
|
ssh-keygen -t ed25519 -C "<email>"
|
|
```
|
|
|
|
## Configure Git User
|
|
|
|
You can configure your Git user name and email using the following commands:
|
|
|
|
```bash
|
|
git config --global user.name "Your Name"
|
|
git config --global user.email "<email>"
|
|
``` |