Podekscytowany jest gotów zrobić mój pierwszy git push
kiedykolwiek stworzyłem alias PuTTY
w moim cygwin środowiska:git Push za pomocą PuTTY na Windows nie powiedzie się (śmiertelne: Zdalny koniec rozłączył się niespodziewanie)
alias ssh="/cygdrive/c/PROGRA~2/putty/PUTTY.EXE"
Następnie wywoływana (w moim katalogu roboczym, oczywiście), jak wyjaśniono na stronie 47 w git community book:
git push ssh://mylinuxserver/~winwin/gitrepo master:master
moje podniecenie nie trwało bardzo długo, bo od razu nie powiodło się z błędem krytycznym:
error: cannot run ssh: No such file or directory
fatal: unable to fork
Biorąc pod uwagę, że jestem w stanie uruchomić pomyślnie, z tej samej linii poleceń powłoki i dokładnie instancja, ssh [email protected]
Jestem bardzo zaskoczony, że ten komunikat o błędzie.
Każdy pomysł, dlaczego tak się dzieje i jak to naprawić?
AKTUALIZACJA I: Dzięki this guide, odkryłem, że PUTTY.EXE nie jest poprawna exe do wykorzystania w git. Zamiast tego należy użyć PLINK.EXE.
Przewodnik ten informuje również, że należy użyć zmiennej środowiskowej o nazwie GIT_SSH, aby dać znać gitowi, jak wykonywać magię. Więc:
~/sb/ws> export GIT_SSH=/cygdrive/c/PROGRA~2/putty/PLINK.EXE
~/sb/ws> git push ssh://mylinuxserver/~winwin/gitrepo master:master
I teraz otrzymuję inny błąd:
fatal: The remote end hung up unexpectedly
uważam ten postęp we właściwym kierunku, ale nadal nie wiem, jak rozwiązać ten problem. Każdy pomysł byłby bardzo doceniany.
UPDATE II: Nadal próbuję rozwiązać tę zagadkę. Tym razem podejrzewałem, że ponieważ git push
nie pyta nigdzie o nazwę użytkownika + hasło, uwierzytelnianie musi leżeć w kluczach ... Tak, sprawdziłem podwójnie sshd
konfigurację na this howto. Jedyną rzeczą, którą uznałem za wymagającą zmiany było odkomentowanie linii HostKey /etc/ssh/ssh_host_dsa_key
w /etc/ssh/sshd_config
i ponowne uruchomienie usługi service sshd restart
. Po raz pierwszy po tym, $GIT_SSH
zrobił monit z prośbą o potwierdzenie tego serwera DSS key fingerprint i potwierdziłem przechowywania klucza w pamięci podręcznej, ale ... Problem nadal występuje:
fatal: The remote end hung up unexpectedly
Dodatkowe pomysły?
(rejestr Putty zawierają teraz dwa klucze do tego samego serwera. [email protected]:mylinuxserver
i [email protected]:mylinuxserver
Hmmm ... Nie jestem pewien, co to znaczy)
Więcej informacji diagnostycznych: Wpisanie $GIT_SSH -v
plony:
~/sb/ws> $GIT_SSH -v
Looking up host "mylinuxserver"
Connecting to 192.168.1.2 port 22
Server version: SSH-2.0-OpenSSH_4.2
We claim version: SSH-2.0-PuTTY_Release_0.60
Using SSH protocol version 2
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-1
Host key fingerprint is:
ssh-dss 1024 c8:77:42:4f:76:29:56:4c:ea:b0:11:6a:a6:3c:6a:f7
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
login as: winwin
[email protected]'s password:
Sent password
Access granted
Opened channel for session
Allocated pty (ospeed 38400bps, ispeed 38400bps)
Started a shell/command
Last login: Wed Jul 13 21:41:12 2011 from winmachine
Czy widzisz coś podejrzanego?
Dojazd: Zdecydowanie najlepszy poradnik dla mojej sytuacji: Git, SSH, PuTTY.
Insights:
$GIT_SSH -agent
muszą być uruchamiane raz- PAGEANT.EXE musi być uruchomiony w tle (klucz prywatny i dodaje do niego poprzez jego zasobniku ikony!)
- PUTTYGEN.EXE musi być użyty do wygenerowania pary kluczy publicznych/prywatnych
- dss nie jest obowiązkowe, RSA jest wystarczająco dobre.
- More? (Chyba
$GIT_SSH -2 -C -i C:\\Users\\winwin\\SSH\\private.ppk
powiedzie bez monitu o hasło, nie ma sensu nawet próbowaćgit push
...)
Po skopiowaniu & wklejenie klucz publiczny z PuTTY generator klucza do /home/winwin/.ssh/authorized_keys
w mylinuxserver
nowa wiadomość pojawiła się w odpowiedzi na polecenie w wnikliwości # 5 powyżej:
Server refused our key
To dobry znak ... :) Myślę, że jestem na najlepszej drodze do rozwiązania zagadki.
UPDATE III: Po zmianie StrictModes
do nr w /etc/ssh/sshd_config
na serwerze sshd, udało mi się osiągnąć sukces z $GIT_SSH -2 -C -i C:\\Users\\winwin\\SSH\\private.ppk
. Nadal jednak monituje o nazwę użytkownika (ale nie pyta o hasło).
git push ssh://mylinuxserver/~winwin/gitrepo master:master
nadal nie jednak - z tym samym komunikatem o błędzie:
fatal: The remote end hung up unexpectedly
To szaleństwo.
AKTUALIZACJA IV: Parametr do PLINK jest -l username
. Udało mi się pomyślnie zalogować git push
, tworząc 1-wierszowy skrypt powłoki /cygdrive/c/PROGRA~2/putty/PLINK.EXE -l winwin $*
i eksportując całą ścieżkę skryptu do $GIT_SSH
, ale "zdalny koniec nadal nieoczekiwanie się zawiesza".
To co ja dostaję na kliencie (Windows/PuTTY) strona:
~/sb/ws> git push ssh://mylinuxserver/~winwin/gitrepo master:master
Environment:
USER=winwin
LOGNAME=winwin
HOME=/home/winwin
PATH=/usr/local/bin:/bin:/usr/bin
MAIL=/var/mail/winwin
SHELL=/bin/bash
SSH_CLIENT=192.168.1.8 50951 22
SSH_CONNECTION=192.168.1.8 50951 192.168.14.2 22
bash: mylinuxserver: command not found
fatal: The remote end hung up unexpectedly
i to, co ja dostaję po stronie serwera (Linux/sshd) strona:
debug1: sshd version OpenSSH_4.2p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Bind to port 22 on 0.0.0.0.
Bind to port 22 on 0.0.0.0 failed: Address already in use.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 4 out 4 newsock 4 pipe -1 sock 7
debug1: inetd sockets after dupping: 3, 3
Connection from 192.168.1.8 port 50951
debug1: Client protocol version 2.0; client software version PuTTY_Release_0.60
debug1: no match: PuTTY_Release_0.60
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.2
debug1: permanently_set_uid: 74/74
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server aes256-ctr hmac-sha1 none
debug1: kex: server->client aes256-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST_OLD received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user winwin service ssh-connection method none
debug1: attempt 0 failures 0
debug1: PAM: initializing for "winwin"
debug1: PAM: setting PAM_RHOST to "win7client"
debug1: PAM: setting PAM_TTY to "ssh"
Failed none for winwin from 192.168.1.8 port 50951 ssh2
debug1: userauth-request for user winwin service ssh-connection method publickey
debug1: attempt 1 failures 1
debug1: test whether pkalg/pkblob are acceptable
debug1: temporarily_use_uid: 513/513 (e=0/0)
debug1: trying public key file /home/winwin/.ssh/authorized_keys
debug1: matching key found: file /home/winwin/.ssh/authorized_keys, line 1
Found matching RSA key: bd:a6:4a:6a:04:43:8d:60:d9:bf:66:de:51:13:83:66
debug1: restore_uid: 0/0
Postponed publickey for winwin from 192.168.1.8 port 50951 ssh2
debug1: userauth-request for user winwin service ssh-connection method publickey
debug1: attempt 2 failures 1
debug1: temporarily_use_uid: 513/513 (e=0/0)
debug1: trying public key file /home/winwin/.ssh/authorized_keys
debug1: matching key found: file /home/winwin/.ssh/authorized_keys, line 1
Found matching RSA key: bd:a6:4a:6a:04:43:8d:60:d9:bf:66:de:51:13:83:66
debug1: restore_uid: 0/0
debug1: ssh_rsa_verify: signature correct
debug1: do_pam_account: called
Accepted publickey for winwin from 192.168.1.8 port 50951 ssh2
debug1: monitor_child_preauth: winwin has been authenticated by privileged process
Accepted publickey for winwin from 192.168.1.8 port 50951 ssh2
debug1: PAM: reinitializing credentials
debug1: permanently_set_uid: 513/513
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch_20
debug1: server_input_channel_open: ctype session rchan 256 win 16384 max 16384
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: init
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_channel_req: channel 0 request exec reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req exec
debug1: Received SIGCHLD.
debug1: session_by_pid: pid 3441
debug1: session_exit_message: session 0 channel 0 pid 3441
debug1: session_exit_message: release channel 0
debug1: session_close: session 0 pid 3441
debug1: channel 0: free: server-session, nchannels 1
Connection closed by 192.168.1.8
debug1: do_cleanup
debug1: PAM: cleanup
Closing connection to 192.168.1.8
debug1: PAM: cleanup
Ostatni trop potrzebny ...
- Co
bash: mylinuxserver: command not found
oznacza? - Co to jest
git push
próbuje uruchomić? - Które polecenie?
- Na kliencie lub serwerze SSH?
Czy można utworzyć dowiązanie symboliczne z PuTTY do ssh.exe? –
@Ben Hocking Tak, mogę, ale zobacz moją aktualizację powyżej. Dziękujemy +1. – WinWin
Dlaczego po prostu nie użyjesz "prawdziwego" ssh, tzn. Pakietu openssh Cygwin? – ak2