0

Tengo problemas al intentar subir los cambios de mi repositorio local al remoto a través de una llave ssh:

ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository.

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

9
  • 1
    Hola, bienvenido a SOes, ¿ya seguiste todos los pasos en Generating an SSH key? O, en su defecto, leíste la sección SSH de GitHub Help
    – César
    el 5 feb. 2016 a las 16:17
  • Ya segui los pasos, e inicie el ssh-agent pero el problema es que no me deja copiar la ruta de mi llave al ssh-agent -->## Could not open a connection to your authentication agent.
    – Juan David
    el 5 feb. 2016 a las 17:35
  • Juan, podrías agregar por favor como estas intentando subir tus cambios, recuerda que es importante agregues información para poder diagnosticar con mejor acierto los problemas.
    – Jorgesys
    el 5 feb. 2016 a las 20:11
  • He repetido muchas veces este mismo proceso , 1. Empieze creando la llave atravez de ssh-keygen, 2. despues de creado abro la llave que se ha esta en la carpeta .ssh/id_rsa.pub, 3. Luego la agrego a github y depues inicializo el ssh-agent ,pero cuando quiero subir cambios no me permite atravez de git push origin master , me muestra este mensaje --> ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
    – Juan David
    el 5 feb. 2016 a las 20:47
  • En caso ssh no puede hacer una conección a SSH agent trabaja sin el, preguntando todo en la terminal. Considera usar ssh puro sin git completamente: espero que tengas problemas con la conección, por causa del cortafuegos o algo. el 5 feb. 2016 a las 22:48

2 respuestas 2

2

No es la respuesta completa, sólo un ejemplo como explorar el problema, no puedo ponerlo en los comentarios:

apagamos uso de ssh-agent:

alex@rhyme git/alt/log4cplus $ unset SSH_AGENT_PID
alex@rhyme git/alt/log4cplus $ unset SSH_AUTH_SOCK

ahora nos conectamos a github.com sin git completamente:

alex@rhyme git/alt/log4cplus $ ssh -v git@github.com
OpenSSH_6.7p1, OpenSSL 1.0.2f  28 Jan 2016
debug1: Reading configuration data /home/alex/.ssh/config
debug1: /home/alex/.ssh/config line 145: Applying options for github.com
debug1: Reading configuration data /etc/openssh/ssh_config
debug1: /etc/openssh/ssh_config line 20: Applying options for *
debug1: Connecting to github.com [192.30.252.129] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_rsa-cert type -1
debug1: identity file /home/alex/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes256-ctr hmac-sha2-512 none
debug1: kex: client->server aes256-ctr hmac-sha2-512 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/alex/.ssh/known_hosts:14
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/alex/.ssh/id_rsa
debug1: Offering DSA public key: /home/alex/.ssh/id_dsa
debug1: Server accepts key: pkalg ssh-dss blen 817
debug1: key_load_private_type: incorrect passphrase supplied to decrypt private key
Enter passphrase for key '/home/alex/.ssh/id_dsa':

Podemos ver que ssh se ha parado para preguntar la clave en la terminal, sin uso el agente.

Ahora añadimos la configuración especifica de github.com a `.ssh/config':

Host github.com
   LogLevel DEBUG1

Repetimos con git:

alex@rhyme git/alt/log4cplus $ git clone git@github.com:wilx/log4cplus /var/tmp/log4cplus
Cloning into '/var/tmp/log4cplus'...
debug1: Connecting to github.com [192.30.252.130] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_rsa-cert type -1
debug1: identity file /home/alex/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alex/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes256-ctr hmac-sha2-512 none
debug1: kex: client->server aes256-ctr hmac-sha2-512 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/alex/.ssh/known_hosts:14
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/alex/.ssh/id_rsa
debug1: Offering DSA public key: /home/alex/.ssh/id_dsa
debug1: Server accepts key: pkalg ssh-dss blen 817
debug1: key_load_private_type: incorrect passphrase supplied to decrypt private key
Enter passphrase for key '/home/alex/.ssh/id_dsa': 
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([192.30.252.130]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = ru_RU.UTF-8
debug1: Sending command: git-upload-pack 'wilx/log4cplus'
remote: Counting objects: 25373, done.
remote: Total 25373 (delta 0), reused 0 (delta 0), pack-reused 25373
Receiving objects: 100% (25373/25373), 23.27 MiB | 3.22 MiB/s, done.
Resolving deltas: 100% (18643/18643), done.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 15760, received 24451448 bytes, in 37.2 seconds
Bytes per second: sent 423.6, received 657153.1
debug1: Exit status 0
Checking connectivity... done.

Te aconsejo que verifiques que ssh puedas conectarse sin git, comparando el éxito de mi ejemplo y lo en tu ordenador.

P.S. perdona por favor mi Español, no soy hispanohablante nativo. Y no usé Google Translate tampoco.

Edit: Uso la clave DSA y tu clave es RSA. Algunos proyectos tienen/tenian problemas (en Inglés) con RSA. Quizas el cambio del tipo prodría eliminar el problema. Use ssh-keygen -t dsa para crear la clave.

4
  • Oye donde debo hacer esto ya que no se donde se encuentra esta carpeta o como hago este paso, --> configuración especifica de github.com a `.ssh/config': mepodrias ayudar gracias
    – Juan David
    el 6 feb. 2016 a las 23:24
  • 1
    Pues, $HOME/.ssh/config es la carpeta para ssh configuraciones para cado usuario. Cree la nueva si no la tienes. El formato es muy simple, la linea Host <Hostname> y después algunas lineas con las opciones; en tu caso es la unica linea LogLevel DEBUG1. ¿Has intentado cambiar el tipo de la clave? ¿Qué has visto en el éxito de ssh -v git@github.com? Creo que sería útil mostrárnoslo en tú pregunta. el 7 feb. 2016 a las 0:17
  • ` user3159253` muchas gracias por su colaboracion, ya he podido agregar los cambios a mi proyecto remoto , el motivo era por que no tenia el archivo .ssh/config creado con la configuracion especifica
    – Juan David
    el 7 feb. 2016 a las 0:39
  • Ok, entonces para los todos que podrian tener el mismo problema sería mejor explicar que problema era y cómo lo has reparado, quizá en una respuesta separada. . el 7 feb. 2016 a las 5:41
-1

Asegurate de tener en tu .git/config el url correcto, es importante para SSH que agregues tu usuario:

url = git@github.com:nombreusuario/repo.git

después vuelve a realizar:

$ git push origin master
1
  • Oye Elenasys cuando te refieres .git/config esto desde donde lo debo hacer localmente o al copiar el repositorio de github en la clipboard
    – Juan David
    el 6 feb. 2016 a las 16:16

Tu Respuesta

Al pulsar en “Publica tu respuesta”, muestras tu consentimiento a nuestros términos de servicio, política de privacidad y política de cookies

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.