2

EDIT: POSSIBLE FIX

In addition to the answers submitted, anyone with this error/same issue could also try running the command $ ssh-add ~/.ssh/id_rsa. This seems to work for me any time I need to get passed this error!


I'm very very new to using git and I've never deployed to gh-pages before, so I'm not sure what I'm doing wrong. I put in the homepage, dependencies, and scripts in my package.json file and when I run $ yarn run deploy everything works until the very end. It tells me it's ready to be deployed to the page I want, and then it gives me this error:

Cloning into 'node_modules/gh-pages/.cache/git@github.com!emilybossiere!GrabBag.git'...
Permission denied (publickey).
fatal: Could not read from remote repository.

I've followed the GitHub instructions for this specific error, which led me to this page about checking for an SSH key. I've been successfully pushing to this repo the entire time I've worked on the application, so I know it's authenticated and it works, but for some reason deployment doesn't work.

This is my output when I run $ ssh -vT git@github.com

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: Connecting to github.com [192.30.255.112] port 22.
debug1: Connection established.
debug1: identity file /Users/emilybo/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emilybo/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emilybo/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emilybo/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emilybo/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emilybo/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emilybo/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/emilybo/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version babeld-80573d3e
debug1: no match: babeld-80573d3e
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/emilybo/.ssh/known_hosts:4
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/emilybo/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([192.30.255.112]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Hi emilybossiere! You've successfully authenticated, but GitHub does not provide shell access.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2724, received 2236 bytes, in 0.1 seconds
Bytes per second: sent 31128.3, received 25551.7
debug1: Exit status 1

So it seems to connect just fine, so when I do $ eval "$(ssh-agent -s)" it returns > Agent pid 59566 as it should, but when I run $ ssh-add -l -E md5, it tells me The agent has no identities. Does this mean it's not actually authenticated?

Also, step 2 of this page says something about automatically loading keys into the ssh agent, but I've never done this before and I'm not sure how to modify my ~/.ssh/config file but I don't even seem to have one? How do I modify this file if it doesn't exist? :(

2 Answers 2

2

If you are getting this error and you use a passphrase for git authentication then this solution may work for you:

  1. cd ~ and open a file called .bashrc and add these lines
eval `ssh-agent -s`
ssh-add

This assumes that your key is in the conventional ~/.ssh/id_rsa location. If it isn't, include a full path after the ssh-add command.

Add to or create file ~/.ssh/config with the contents

ForwardAgent yes
  1. restart your terminal (You might want to reboot your system first)

  2. You should be prompted for your passphrase

  3. Now try npm run deploy

1

For Windows users here is the fix:

  1. Edit C:\Users\YOUR_USER\.ssh\config
  2. Add to the config file:
Host github.io
  AddKeysToAgent yes
  IdentityFile C:\Users\YOUR_USER\.ssh\your_key.pub
  1. Run the deploy from Git Bash instead of your IDE's terminal or you won't get the password prompt.
1
  • you made a typo in the config file path (missing a slash before .ssh) Nov 26, 2021 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.