3

我尝试按照本教程中编写的步骤在 godaddy 共享主机上安装 git 。Git 工作,我创建了一个提交和一个副本,但我没有设法解决步骤 5 中提到的路径问题,所以我无法从远程计算机上传和下载。我在这里发现了很多关于同一主题的问题,尝试了一切,但没有奏效。知道如何解决吗?

git错误信息:

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

~/.gitconfig(由“git config --global”命令创建)

[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

我讨厌这个 :-(

编辑:

ssh 连接日志:

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:~]>

我可以通过 ssh 创建、删除、下载文件,所以我认为问题出在 git 上,而不是 ssh 和我的本地计算机设置上。

Edit2: 使用 git bash 这有效:

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

所以有一个我无法解决的 git config 问题,我尝试这样配置 git:

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

这是无效的。在教程中没有--global,但没有它给了我错误:无法锁定.git/config没有这样的文件或目录......

所以 git 可以工作,但是它有配置问题,并且 git gui ssh 连接还有另一个问题......

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

这是文件内容(每个键都有严重的变化)

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
4

1 回答 1

2

我会尝试使用这些可执行文件的完整路径:

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

我确认您的系统sshd_config包含PermitUserEnvironment no.bashrc 与 SSH 会话无关。

OP inf3rno得出结论:

行。有误会git clone
本地机器配置文件必须有上传包的位置,而不是服务器上的配置文件
另一种解决方案可能是,在克隆之前,我们在服务器上插入一个配置文件,其中包含 git 二进制文件的位置。
我尝试了第一个解决方案,效果很好。


笔记:

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

是公共 SSH 密钥未正确复制的迹象(在源中/c/Users/inf3rno/.ssh/id_rsa或在目标中~/.ssh/authorized_keys)。
这通常意味着密钥已被吐成几行,而不是一长行(在这个答案中提到。

所以像:

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

代替:

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

OP Inf3rno提到:

配置问题的服务器端解决方案[由 inf3rno 编辑]:

我将 git 安装到~/git并添加了以下文件:

~/.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

所以现在它在任何 git 命令之前设置 env 变量......
遗憾的是 GoDaddy 没有其他方法,只有 authorized_keys hax。在 git 命令之前不执行其他文件。

于 2012-04-27T06:18:00.463 回答