GIT no existe tal identidad: id_rsa: no existe tal archivo o directorio

4 minutos de lectura

avatar de usuario de fear.jpg
miedo.jpg

Creé un repositorio en github y quiero enviar mi código, pero obtuve los siguientes consejos:

$ git push -u origin master
no such identity: id_rsa: No such file or directory
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Pero el archivo id_rsa existetraté de agregar la clave pública id_rsa en mi configuración de github nuevamente, y github me dijo que se había utilizado este público.

$ ls
config      id_rsa      id_rsa.pub  known_hosts

este es mi .ssh/ carpeta

El archivo de configuración contiene la configuración de git de serval en un sitio de git diferente. Todos usaban la misma clave pública y podían funcionar con éxito.

Lo que hice:

$git init
$git add .
$git commit -m "first commit"
$git remote add [my remote git repository address]
$git push -u origin master
// ....  error message

ACTUALIZAR:

$ git config core.sshCommand "ssh -v"
$ git push -u origin master
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data ~/.ssh/config
debug1: ~/.ssh/config line 2: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to github.com port 22.
debug1: Connection established.
debug1: identity file id_rsa type -1
debug1: identity file id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version babeld-003ebee6
debug1: no match: babeld-003ebee6
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 ~/.ssh/known_hosts:1
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: Will attempt key: id_rsa  explicit
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: Trying private key: id_rsa
no such identity: id_rsa: No such file or directory
debug1: No more authentication methods to try.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

  • Correr git config core.sshCommand "ssh -v"y luego publicar los nuevos errores producidos por git push -u origin master.

    –Kevin

    12 de octubre de 2019 a las 9:11

  • Parecía que había configurado la clave privada en la ruta incorrecta. La ruta correcta se registraría así “debug1: Probar clave privada: /Users/lpp/.ssh/id_dsa”

    –Kevin

    12 de octubre de 2019 a las 9:43

  • @Kevin Gracias por su respuesta, edité mi archivo de configuración en ~/.ssh/configy editar IdentityFile id_rsa a IdentityFile ~/.ssh/id_rsa y reintentado git push -u origin masterY funcionó

    – miedo.jpg

    12 de octubre de 2019 a las 9:49


  • ESTÁ BIEN. He agregado la respuesta completa a la wiki de la comunidad.

    –Kevin

    12 de octubre de 2019 a las 9:52

  • Si eres como yo, tal vez eras un completo idiota y te olvidaste de correr. ssh-add <options> <path/to/your/key>

    – Devin Rhode

    11 de agosto de 2021 a las 4:02

debug1: Will attempt key: id_rsa  explicit
...
debug1: Trying private key: id_rsa
no such identity: id_rsa: No such file or directory

Configuró la ruta de clave privada incorrecta. Prueba a configurarlo así.

Host github.com
IdentityFile ~/.ssh/id_rsa

  • ¿Configurar dónde? ¿Qué archivo de configuración?

    – CGFoX

    21 oct 2020 a las 11:48

  • @CGFoX ~/.ssh/config

    –Kevin

    25 de octubre de 2020 a las 5:27

Por 2 años, Archivo de identidad id_rsa trabajó para mi. Hoy, acepta solo un camino absoluto como en Archivo de identidad ~/.ssh/id_rsa. Cosa rara.

  • Para mí, el problema es poner comillas e IdentityFile ‘~/.ssh/id_rsa’ o IdentityFile ‘/home/user/.ssh/id_rsa’ Desafortunadamente, las comillas deben eliminarse.

    – RW Prado

    5 de mayo a las 17:48


¿Ha sido útil esta solución?