为什么这个git clone命令失败? [英] Why is this git clone command failing?

查看:3679
本文介绍了为什么这个git clone命令失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 git clone 命令。我的理解(如果错误,请更正)是为了托管一个Git仓库,您只需要一台运行ssh的机器以及位于其允许位置的项目/存储库。



我在运行ssh的OS X系统上有我的git存储库。我试图在Windows XP系统上克隆它。我在XP机器上安装了Git Bash。在Git bash(MINGW)控制台中,我可以进入Mac没有问题。



但是, 失败......



$ $ $ $ g $克隆用户名@主机:〜/ project / path / contactdb
初始化的空的Git仓库in
c:/ Documents and Settings / Administrator / My Documents / projects / contactdb / .git /
bash:git-upload-pack:找不到命令
致命:远程端意外挂断

使用和不使用 .git 扩展名:

pre $ g $克隆用户名@主机:〜/ project / path / contactdb

$ git clone username @ host:〜/ project / path / contactdb.git

Mac?

解决方案

您需要在要克隆Git存储库的计算机上安装Git;当执行ssh时, git-upload-pack 必须位于远程机器上的$ PATH中。当你直接跳到远程机器时,你会得到如下的响应:

  $ ssh username @ host git-upload- pack --help 
usage:git upload-pack [--strict] [--timeout = nn]< dir>

或以下(错误)回应:

  $ ssh username @ host git-upload-pack --help 
bash:git-upload-pack:找不到命令

(当然shell的名字取决于远程端使用的是什么)。



也有可能是问题(虽然可能不是你的情况)是配置错误的远程机器,因此使用交互式shell进行ssh连接,或者在连接时给出一些消息,或者设置交互变量像臭名昭着的$ CDPATH环境变量。

Trying to use the git clone command. My understanding (please correct if wrong) was that in order to host a Git repository you just need a machine running ssh and the project/repository sitting on it in a permitted location.

I have my git repository on an OS X system that's running ssh. I'm trying to clone it on a Windows XP system. I have Git Bash installed on the XP machine. In the Git bash (MINGW) console, I can ssh into the Mac no problem.

However, git clone fails...

$ git clone username@host:~/project/path/contactdb
Initialized empty Git repository in 
  c:/Documents and Settings/Administrator/My Documents/projects/contactdb/.git/
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly

Tried it with and without .git extension:

$ git clone username@host:~/project/path/contactdb

$ git clone username@host:~/project/path/contactdb.git

Do I need something else installed on the Mac?

解决方案

You need to have Git installed on the machine that has Git repository you want to clone; also git-upload-pack has to be in $PATH on remote machine when doing ssh. Do you get something like the following response when directly ssh-ing to remote machine:

$ ssh username@host git-upload-pack --help
usage: git upload-pack [--strict] [--timeout=nn] <dir>

or the following (wrong) response:

$ ssh username@host git-upload-pack --help
bash: git-upload-pack: command not found

(of course name of shell depends on what remote side is using).

What also might be problem (although perhaps not in your case) is having misconfigured remote machine so that uses interactive shell for ssh connection, either giving some messages on connection, or setting interactive variables like infamous $CDPATH environmental variable.

这篇关于为什么这个git clone命令失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆