克隆工作,远程推送没有。通过copssh远程存储库

时间:2010-04-29 11:29:54

标签: git ssh msysgit windows-7-x64 copssh

我已经在Tim Davis'guide之后“设置-msysgit-server-with-copssh-on-windows”,我正在学习如何使用git命令,遵循Jason Meridth的{{ 3}},我已经设法使一切工作正常,但现在我无法传递push命令。

我已将服务器和客户端设置在同一台机器上(目前为止),win7-x64。

以下是有关如何设置事项的一些信息:

CopSSH Folder     : C:/SSH/
Local Home Folder : C:/Users/rvc/
Remote Home Folder: C:/SSH/home/rvc/          # aka /cygdrive/c/SSH/home/rvc/
git remote rep    : C:/SSH/home/rvc/myapp.git # empty rep

在'/SSH/home/rvc/.bashrc'和'Users / rvc / .bashrc':

export HOME=/cygdrive/c/SSH/home/rvc
gitpath='/cygdrive/c/Program Files (x86)/Git/bin'    
gitcorepath='/cygdrive/c/Program Files (x86)/Git/libexec/git-core'
PATH=${gitpath}:${gitcorepath}:${PATH}

所以,克隆工作(下面的所有内容都通过“Git Bash在这里完成”:P):

rvc@RVC-DESKTOP /c/code
$ git clone ssh://rvc@192.168.1.65:5858/SSH/home/rvc/myapp.git
Initialized empty Git repository in C:/code/myapp/.git/
warning: You appear to have cloned an empty repository.

rvc@RVC-DESKTOP /c/code
$ cd myapp

rvc@RVC-DESKTOP /c/code/myapp (master)
$ git remote -v
origin  ssh://rvc@192.168.1.65:5858/SSH/home/rvc/myapp.git (fetch)
origin  ssh://rvc@192.168.1.65:5858/SSH/home/rvc/myapp.git (push)

然后我创建了一个文件:

rvc@RVC-DESKTOP /c/code/myapp (master)
$ touch test.file

rvc@RVC-DESKTOP /c/code/myapp (master)
$ ls
test.file

尝试推送它并收到此错误:

rvc@RVC-DESKTOP /c/code/myapp (master)
$ git add test.file

rvc@RVC-DESKTOP /c/code/myapp (master)
$ GIT_TRACE=1 git push origin master
trace: built-in: git 'push' 'origin' 'master'
trace: run_command: 'C:\Users\rvc\bin\plink.exe' '-batch' '-P' '5858' 'rvc@192.1
68.1.65' 'git-receive-pack '\''/SSH/home/rvc/myapp.git'\'''
git: '/SSH/home/rvc/myapp.git' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly

“git:'/ SHSH / home / rvc / myapp.git'不是git命令。请参阅'git --help'。” ..什么?!

修改 RAAAGE !!

我再次遇到同样的问题,但现在使用ssh:

rvc@RVC-DESKTOP /c/code/myapp (master)
$ GIT_TRACE=1 git push
trace: built-in: git 'push'
trace: run_command: 'ssh' '-p' '5858' 'rvc@192.168.1.65' 'git-receive-pack '\''/
SSH/home/rvc/myapp.git'\'''
git: '/SSH/home/rvc/myapp.git' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly

我尝试了GUI推送,并显示相同的消息。

git: '/SSH/home/rvc/myapp.git' is not a git command. See 'git --help'.
Pushing to ssh://rvc@192.168.1.65:5858/SSH/home/rvc/myapp.git
fatal: The remote end hung up unexpectedly

这是潮流.bashrc:

C:\ Users \ rvc.bashrc(我认为这只能用于cygwin / git bash):

export HOME=/c/SSH/home/rvc

gitpath='/c/Program Files (x86)/Git/bin'

gitcorepath='/c/Program Files (x86)/Git/libexec/git-core'
export GIT_EXEC_PATH=${gitcorepath}

PATH=${gitpath}:${gitcorepath}:${PATH}

C:\ SSH \ home \ rvc.bashrc(..并且当git通过ssh连接到“远程”服务器时使用):

export HOME=/c/SSH/home/rvc

gitpath='/cygdrive/c/Program Files (x86)/Git/bin'

gitcorepath='/cygdrive/c/Program Files (x86)/Git/libexec/git-core'
export GIT_EXEC_PATH=${gitcorepath}

PATH=${gitpath}:${gitcorepath}:${PATH}

编辑2: 一些额外的信息:

rvc@RVC-DESKTOP /c/code/myapp (master)
$ ssh -p 5858 rvc@192.168.1.65 git-receive-pack /SSH/home/rvc/myapp.git
git: '/SSH/home/rvc/myapp.git' is not a git command. See 'git --help'.


编辑3:

rvc@RVC-DESKTOP /c/code/myapp (master)
$ git push --receive-pack='git receive-pack' ssh://rvc@192.168.1.65:5858/SSH/home/rvc/myapp.git --a
ll
Counting objects: 3, done.
Writing objects: 100% (3/3), 202 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://rvc@192.168.1.65:5858/SSH/home/rvc/myapp.git
 * [new branch]      master -> master

这有没有诀窍??

git push正在运行'git-receive-pack',它应该是'git receive-pack'?

我的git版本是'git version 1.7.0.2.msysgit.0'

4 个答案:

答案 0 :(得分:11)

愚蠢的修复(这改变了/SSH/home/rvc/.gitconfig):

rvc@RVC-DESKTOP /c/code/myapp (master)
$ git config --global remote.origin.receivepack "git receive-pack"

rvc@RVC-DESKTOP /c/code/myapp (master)
$ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 246 bytes, done.
Total 2 (delta 0), reused 0 (delta 0)
To ssh://rvc@192.168.1.65:5858/SSH/home/rvc/myapp.git
   680f32e..2da0df1  master -> master

答案 1 :(得分:1)

1)通常导致此问题的原因 - 打开Git Bash窗口并键入echo $HOME - 确保将其设置为/c/SSH/Home/<user>/。如果不是 - 请输入export HOME=/c/SSH/home/<user>

2)尝试GUI界面[同样的问题?]

答案 2 :(得分:1)

找到answer ...

  

GIT_SSH

If this environment variable is set then git fetch and git push will
     

使用此命令而不是ssh时   他们需要连接到遥控器   系统。 $ GIT_SSH命令将是   给出两个参数:   来自的username @ host(或者只是host)   URL和要执行的shell命令   在那个远程系统上。

To pass options to the program that you want to list in GIT_SSH you
     

将需要包装程序和   选项到shell脚本,然后设置   GIT_SSH引用shell脚本。

Usually it is easier to configure any desired options through your
     

个人.ssh /配置文件。请   请查阅您的ssh文档   进一步的细节。

我只需要从windows环境变量中删除GIT_SSH var。

我已经设置了因为我正在关注Tim Davis的指南,但是没有使用TortoiseGit, 指南说要将变量指向TortoisePlink(步骤4.4),所以我认为我必须这样做 指向plink.exe:P。好吧......转到下一个问题......

答案 3 :(得分:1)

谢谢!我也得到了错误

git: '/pathToRepo/myRepoName.git' is not a git command See 'git --help'.
fatal: The remote end hung up unexpectedly

git config命令对我有用。

git config --global remote.origin.receivepack "git receive-pack"

我正在运行MSysGit-1.7.3.1