Git on godaddy - git-upload-pack not found

2019-04-11 18:11发布

问题:

I tried to install git on godaddy shared host following steps written in this tutorial. Git works, I created a commit and a copy, but I didn't manage to solve the path problem mentioned in step 5, so I cannot upload and download from remote computer. I found here a lot of questions in the same topic, tried everything, but haven't worked. Any idea how to fix it?

git error message:

bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly

~/.gitconfig (created by "git config --global" commands)

[remote "origin"]
        receivepack = libexec/git-core/git-receive-pack
        uploadpack = libexec/git-core/git-upload-pack

~/.bash_profile

PS1="[\u@\h:\W]> "
export EDITOR=vim
export PATH=$PATH:$HOME/bin:$HOME/libexec/git-core
export LD_LIBRARY_PATH=$HOME/lib
export GIT_EXEC_PATH=~/libexec/git-core
export GIT_TEMPLATE_DIR=~/share/git-core/templates

I hate this :-(

Edit:

ssh connection log:

Welcome to Git (version 1.7.7.1-preview20111027)


Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.

inf3rno@INF3RNO-PC ~
$ ssh -vvv user@mygodaddyhost.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug2: ssh_connect: needpriv 0
debug1: Connecting to mygodaddyhost.com [11.111.111.1] port 22.
debug1: Connection established.
debug1: identity file /c/Users/inf3rno/.ssh/identity type -1
debug3: Not a RSA1 key file /c/Users/inf3rno/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /c/Users/inf3rno/.ssh/id_rsa type 1
debug1: identity file /c/Users/inf3rno/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-g
roup-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour1
28,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-c
tr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour1
28,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-c
tr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@open
ssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@open
ssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-g
roup-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour1
28,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-c
tr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour1
28,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-c
tr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 139/256
debug2: bits set: 537/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /c/Users/inf3rno/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 2
debug3: check_host_in_hostfile: filename /c/Users/inf3rno/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 2
debug1: Host 'mygodaddyhost.com' is known and matches the DSA host key.
debug1: Found key in /c/Users/inf3rno/.ssh/known_hosts:2
debug2: bits set: 533/1024
debug1: ssh_dss_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /c/Users/inf3rno/.ssh/identity (0x0)
debug2: key: /c/Users/inf3rno/.ssh/id_rsa (0xa01a438)
debug2: key: /c/Users/inf3rno/.ssh/id_dsa (0x0)
debug1: Authentications that can continue: publickey,gssapi-with-mic,password,ke
yboard-interactive
debug3: start over, passed a different list publickey,gssapi-with-mic,password,k
eyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/inf3rno/.ssh/identity
debug3: no such identity: /c/Users/inf3rno/.ssh/identity
debug1: Offering public key: /c/Users/inf3rno/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff

debug3: sign_and_send_pubkey
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 0
debug3: tty_make_modes: ospeed 38400
debug3: tty_make_modes: ispeed 38400
debug3: tty_make_modes: 1 3
debug3: tty_make_modes: 2 28
debug3: tty_make_modes: 3 8
debug3: tty_make_modes: 4 21
debug3: tty_make_modes: 5 4
debug3: tty_make_modes: 6 0
debug3: tty_make_modes: 7 0
debug3: tty_make_modes: 8 17
debug3: tty_make_modes: 9 19
debug3: tty_make_modes: 10 26
debug3: tty_make_modes: 12 18
debug3: tty_make_modes: 13 23
debug3: tty_make_modes: 14 22
debug3: tty_make_modes: 18 15
debug3: tty_make_modes: 30 0
debug3: tty_make_modes: 31 0
debug3: tty_make_modes: 32 0
debug3: tty_make_modes: 33 0
debug3: tty_make_modes: 34 0
debug3: tty_make_modes: 35 0
debug3: tty_make_modes: 36 1
debug3: tty_make_modes: 37 0
debug3: tty_make_modes: 38 1
debug3: tty_make_modes: 39 0
debug3: tty_make_modes: 40 0
debug3: tty_make_modes: 41 0
debug3: tty_make_modes: 50 1
debug3: tty_make_modes: 51 1
debug3: tty_make_modes: 53 1
debug3: tty_make_modes: 54 0
debug3: tty_make_modes: 55 0
debug3: tty_make_modes: 56 0
debug3: tty_make_modes: 57 0
debug3: tty_make_modes: 58 0
debug3: tty_make_modes: 59 1
debug3: tty_make_modes: 60 0
debug3: tty_make_modes: 61 0
debug3: tty_make_modes: 70 1
debug3: tty_make_modes: 71 0
debug3: tty_make_modes: 72 1
debug3: tty_make_modes: 73 0
debug3: tty_make_modes: 74 0
debug3: tty_make_modes: 75 0
debug3: tty_make_modes: 90 1
debug3: tty_make_modes: 91 1
debug3: tty_make_modes: 92 0
debug3: tty_make_modes: 93 0
debug2: channel 0: request shell confirm 0
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
Last login: Fri Apr 27 02:00:43 2012 from catv-111-11-111-11.catv.broadband.hu
[user@blabla:~]>

I can create, remove, download files via ssh, so I think the problem is with git, not with the ssh neither with my local computer settings.

Edit2: With git bash this worked:

git clone -u libexec/git-core/git-upload-pack user@host.com:myrepo.git "D:/myrepo"

So there is a git config problem I cannot solve, I tried to configure git this way:

git config --global remote.origin.receivepack libexec/git-core/git-receive-pack
git config --global remote.origin.uploadpack libexec/git-core/git-upload-pack

It was ineffective. In the tutorial there was no --global, but without that it gave me error: could not lock .git/config no such file or directory...

So the git works, but it has configuration problem, and there is another issue with git gui ssh connection...

ls -l .ssh
total 12
-rw------- 1 myuser inetuser  802 Apr 27 02:05 authorized_keys
-rw------- 1 myuser inetuser 1675 Apr 27 00:29 id_rsa
-rw------- 1 myuser inetuser  401 Apr 27 00:29 id_rsa.pub

Here are the file contents (ofc there are serious changes in every key)

vi authorized_keys
ssh-rsa CACAB3NzaC1yc2ECACAFiwCAAQEAugaPHL6tF9eKRNDVBTiIbV6tG6Nusl30EPjVT6z1fDLe2g0iXBFlcB+gziDYrJdLhpV78qShE8+uCM0e2RTSBbYEM3tiZprJy142ESPTLR3IkVEEpEH2hsGMHpP3n3rwSb9dExx/OozrkWYBPIa08TZmp27YE+DgF7ZrVF/WqL9MCnNUM8hllmmBRIuR/gTZHmvE3E5pmIgV7k7umR2xbXk6zsFqUrY7iSPIZSTxE/M26CzngnGaLjTLBlq091tEXxWWek6A9oTPKYCb0LXExKvP7z+hD/uEvdpMjwHI0rtjo600Xe+rYl+bSgl21BAv4y0QlI7gkFwpuuymwYq5aw== inf3rno@INF3RNO-PC

ssh-rsa CACAB3NzaC1yc2ECACAFiwCAAQEA2zjE1e5FT6cgBzNY3Stqc9eY4djVYg3EO/6YkCBUJ/Vxf3X/aXiVpyDmPBuTfWIimS4prtVoXA23bQ6WwdrtgiKPLKIohyV7MFJAOSlACzXlZe5QjzZx4WbLiyGxY32ImFfO1Px9EU71+AtSxXcPLaY1Yn9U/yRpZCU4Bp4E4+ZvrP8hGZwzWNcVBr/u3SsDhIJueqZWxDNvaHlN03P/56z9J4dCt/siPFbUvhu9ztmRamMBYiY72UgUhET7NIJfTZU+CqvIym4jBUKZ5h6ryWRRMYuDTZarSb/K+w0PxNw/eUX565K3MpE/qCAxC+1S3iVdMk6qoRy4tSapCdCtrQ== info@myhost.com
"authorized_keys" 3L, 802C                                    3,1           All


vi id_rsa.pub
ssh-rsa CACAB3NzaC1yc2ECACAFiwCAAQEA2zjE1e5FT6cgBzNY3Stqc9eY4djVYg3EO/6YkCBUJ/Vxf3X/aXiVpyDmPBuTfWIimS4prtVoXA23bQ6WwdrtgiKPLKIohyV7MFJAOSlACzXlZe5QjzZx4WbLiyGxY32ImFfO1Px9EU71+AtSxXcPLaY1Yn9U/yRpZCU4Bp4E4+ZvrP8hGZwzWNcVBr/u3SsDhIJueqZWxDNvaHlN03P/56z9J4dCt/siPFbUvhu9ztmRamMBYiY72UgUhET7NIJfTZU+CqvIym4jBUKZ5h6ryWRRMYuDTZarSb/K+w0PxNw/eUX565K3MpE/qCAxC+1S3iVdMk6qoRy4tSapCdCtrQ== info@myhost.com
"id_rsa.pub" 1L, 401C                                         1,1           All


vi id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBCAKCAQEA2zjE1e5FT6cgBzNY3Stqc9eY4djVYg3EO/6YkCBUJ/Vxf3X/
aXiVpyDmPBuTfWIimS4prtVoXA23bQ6WwdrtgiKPLKIohyV7MFJAOSlACzXlZe5Q
jzZx4WbLiyGxY32ImFfO1Px9EU71+AtSxXcPLaY1Yn9U/yRpZCU4Bp4E4+ZvrP8h
GZwzWNcVBr/u3SsDhIJueqZWxDNvaHlN03P/56z9J4dCt/siPFbUvhu9ztmRamMB
YiY72UgUhET7NIJfTZU+CqvIym4jBUKZ5h6ryWRRMYuDTZarSb/K+w0PxNw/eUX5
65K3MpE/qCAxC+1S3iVdMk6qoRy4tSapCdCtrQIFiwKCAQAZgR1af9S4pWK+/o3Q
IjgNPTYsarlNCOM6DnfV9RDun7UzI22lp2GLVWWR1lHFL8lwl44D5WWpmyrn5GkA
NkcHj1EprCHjj0FGzdt0PzqE8Dd5iQk08EeHeXZZCyo3QYv0J0rWg0F+Uiq9Qx9n
BkrgpUft/+x07gn6EuHU3tv8yaqrnD3ly6m8/tEA2NvsXWWsrR+u2gdXYqoS7z2e
OvaHELGywPvxPJ/q3udumqKes06+RbZX7ph1fzwYlDzy5pZ3qy4m7sMEISWY1SqL
VWhP1avv688mF03wlzoIFi7ORXDlRM9VLYHosMXgt85Zo2Q/f3MEi6hk+bQmEvHc
ZqkbAoGBAQgwoDFkdzMjrZj3XsRVPLGz0HBdxYoWmjKbdKPAY5MDZ02QYXuTqW07
jy4hT/w1kUxyz4kp17MC9lp2ItnjEOUjXFIKFqRFf7dxtcxKodM6MbI8YlPk0f9h
Xv7v97NnLhXG1RPbON9RllC4q4gTg+1RoSPQHxtsJghYqxDVBUIbAoGBAOIex9Ia
bvUKc9dHe5Yzx2qGxyji7E9w+eynVnEqjH/Gc5y7DSqlfz25qT2VArILh1cFWXy2
5tLSOGm2EQwED9Wivxgr6/oczGKZ45lYUAfDnP6B2drrGMHvNZBE7XrQzo3cVs/n
C6cn8CuBLGHIE7hg6QrgqQ/BbcgPVdPsSSGvAoGAf6P6nQ8Yvdny4PQ/Xagt182P
xMKC2Uz134MmfR11Ccc8cQhspfQrP323WY15l6aFO6/Z0YM7uyYYTRFiYW12ZzbB
w8qsjv8rvW2t9AkgBjsvgDxP01+8dLW705Fa0UsBwg58Nhj4rV0ou8yv+Y+FrT/s
eNFvFWrRuyZJWR0YpacCgYEArm+ENF2Iy6j6Rv0A30yD5HaZozK2S+lwV3nGV0y1
hyQQCzE2CvSynVS1wcq477/ARpADNFKUzoTpsKJk7AMiKHY7pO6uuaEv9ErUJdZp
n6QKQK1QSctNnOu7my3bxSS8mVI0Vz004Ajd2Gr2Wg9fq331mq1POAo+vudCNcTn
"id_rsa" 27L, 1675C                                           2,1

回答1:

I would try with the full path for those executable:

[remote "origin"]
        receivepack = /full/absolute/path/to/libexec/git-core/git-receive-pack
        uploadpack = /full/absolute/path/to/libexec/git-core/git-upload-pack

I confirm that is your system sshd_config contains PermitUserEnvironment no, your .bashrc is not relevant in an SSH session.

The OP inf3rno concludes:

Ok. There was a misunderstanding by git clone.
The local machine config file must have the location of the upload pack not the config file on the server.
Another solution could be, that before the clone we insert a config file on the server which contains the location of git binaries.
I tried the first solution, it works well.


Note:

debug1: identity file /c/Users/inf3rno/.ssh/identity type -1
debug3: Not a RSA1 key file /c/Users/inf3rno/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace

is a tell-tale of a public SSH key not copied properly (either at the source in /c/Users/inf3rno/.ssh/id_rsa, or at the destination, in ~/.ssh/authorized_keys).
It usually means that the key has been spit in several lines, instead of being one long line (mentioned in this answer.

So something like:

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAybmcqaU/Xos/GhYCzkV+kDsK8+A5OjaK
5WgLMqmu38aPo56Od10RQ3EiB42DjRVY8trXS1NH4jbURQPERr2LHCCYq6tHJYfJNhUX
/COwHs+ozNPE83CYDhK4AhabahnltFE5ZbefwXW4FoKOO+n8AdDfSXOazpPas8jXi5bE
wNf7heZT++a/Qxbu9JHF1huThuDuxOtIWl07G+tKqzggFVknM5CoJCFxaik91lNGgu2O
TKfY94c/ieETOXE5L+fVrbtOh7DTFMjIYAWNxy4tlMR/59UVw5dapAxH9J2lZglkj0w0
LwFI+7hZu9XvNfMKMKg+ERAz9XHYH3608RL1RQ== This comment describes the 
key

instead of:

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAybmcqaU/Xos/GhYCzkV+kDsK8+A5OjaK5WgLMqmu38aPo56Od10RQ3EiB42DjRVY8trXS1NH4jbURQPERr2LHCCYq6tHJYfJNhUX/COwHs+ozNPE83CYDhK4AhabahnltFE5ZbefwXW4FoKOO+n8AdDfSXOazpPas8jXi5bEwNf7heZT++a/Qxbu9JHF1huThuDuxOtIWl07G+tKqzggFVknM5CoJCFxaik91lNGgu2OTKfY94c/ieETOXE5L+fVrbtOh7DTFMjIYAWNxy4tlMR/59UVw5dapAxH9J2lZglkj0w0LwFI+7hZu9XvNfMKMKg+ERAz9XHYH3608RL1RQ== This comment describes the key

The OP Inf3rno mentions:

Server side solution for the config problem [edited by inf3rno]:

I installed the git to the ~/git and added the following files:

~/.ssh/authorized_keys:

command="~/connect.sh" ssh-rsa aaaaaaaaaaaaa... == inf3rno@INF3RNO-PC

~/connect.sh:

#!/bin/bash
if [ -f "${HOME}/.env_profile" ]; then
        source ~/.env_profile
fi;

if [ "x${SSH_ORIGINAL_COMMAND}x" == "xx" ]; then
        $SHELL --login
else
        eval "${SSH_ORIGINAL_COMMAND}"
fi;

~/.env_profile:

    export PATH=$PATH:$HOME/bin:$HOME/git/libexec/git-core
    export LD_LIBRARY_PATH=$HOME/git/lib
    export GIT_EXEC_PATH=~/git/libexec/git-core
    export GIT_TEMPLATE_DIR=~/git/share/git-core/templates

So now it sets the env variables before any git command...
Sadly there is no other way by GoDaddy, just the authorized_keys hax. Another files are not executed before the git commands.



标签: git bash clone