user11623835
user11623835

Reputation:

How do I configure GitHub to use SSH correctly?

I was following the instructions by github but got stuck on Step 2.

Step 2:

If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.

I don't have a ~/.ssh/config file.

Should I Create one and put it there?

Why do they assume I have a file that I do not?

From their docs:

enter image description here

Note:

I have already generated a key pair.

Upvotes: 1

Views: 4862

Answers (1)

Saurabh P Bhandari
Saurabh P Bhandari

Reputation: 6752

Create a blank config file under this ~/.ssh directory. (~ refers to your HOME directory)

Reference

Based on step 2 from here, add this to the config file,

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa

Update: Quoting this from here,

Name

ssh_config - OpenSSH SSH client configuration files

Description

ssh(1) obtains configuration data from the following sources in the following order:

  1. command-line options
  2. user's configuration file (~/.ssh/config)
  3. system-wide configuration file (/etc/ssh/ssh_config)

For each parameter, the first obtained value will be used. The configuration files contain sections separated by ''Host'' specifications, and that section is only applied for hosts that match one of the patterns given in the specification. The matched host name is the one given on the command line.

Upvotes: 7

Related Questions