Connecting to SSH - git push origin master does not publish

I cannot connect with SSH from my command line to push files to my Github account. That is the last step before I can start publishing projects on my public profile. I have read the tutorials and obtained the keys. When I type git push origin master, the updates do not appear on my Github repo. Can you help? Thank you.

1 Like

You appear to have an ssh key registered:
https://github.com/dougdevitre.keys

does:

ssh git@github.com

work?

You should see something like this:

% ssh git@github.com
Hi jsoref! You've successfully authenticated, but GitHub does not provide shell access.

(It helps to know what OS you’re running.)

If the above works, you can try:

git clone git@github.com:dougdevitre/travel.git

this is the error I receive when I type ssh git@github.com

no such identity: /Users/dougdevitre/.ssh/id_ed25519: No such file or directory

git@github.com: Permission denied (publickey).

In fact, you have two keys:

  • ssh-rsa (4096 SHA256:zFTw3DhY6WeGizNu0RrDPlUYMDFqnnukrjU3jsL642M no comment (RSA))
  • ssh-ed25519 (256 SHA256:CJ9fd4Vt09M37fy+b2mY6RU3ct/M5UhACyLu2MQkdpE no comment (ED25519))

What instructions did you follow?

For debugging, you can try:

ssh -v git@github.com
it should yield something like:

% ssh -v github.com
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/jsoref/.ssh/config
debug1: /Users/jsoref/.ssh/config line 1: Applying options for *
debug1: /Users/jsoref/.ssh/config line 97: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to github.com port 22.
debug1: Connection established.
debug1: identity file /Users/jsoref/.ssh/id_rsa type 0
debug1: identity file /Users/jsoref/.ssh/id_rsa-cert type -1

The type 0 means it found a file, the type -1 means it didn’t find a file. For me, it searches through a whole bunch of potential files. It’s possible to configure things with an IdentityFile config directive which overrides the default search.

You can see that the log output mentions it found config some config sections and applied their settings.

Personally, I’d look at ~/.ssh/config, for host github.com and host * sections. (The log output even tells me which line numbers the sections are on.)

Here are mine:

Host *
ServerAliveInterval 15
ServerAliveCountMax 50
    XAuthLocation /opt/X11/bin/xauth
host github.com
RequestTTY no
user git

You can see man ssh_config for information on ssh.

The user git line is why I can omit git@ in the above.

You could also do:

ls -l ~/.ssh/id_*

That would show you which files you have (with standardish names). The .pub files are the public keys that correspond to the private keys (w/o the .pub extension).