Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
644 views
in Technique[技术] by (71.8m points)

git - Clone works, remote push doesn't. Remote repository over copssh

I've "setup-a-msysgit-server-with-copssh-on-windows", following Tim Davis' guide and I was now learning how to use the git commands, following Jason Meridth's guide, and I have managed to get everything working fine, but now I can't pass the push command.

I have set the server and the client on the same machine (for now), win7-x64.

Here is some info of how things are set up:

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

At '/SSH/home/rvc/.bashrc' and '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}

So, cloning works (everything bellow is done via "Git Bash here" :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)

Then I create a file:

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

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

Try to push it and get this error:

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
vcinplink.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: '/SSH/home/rvc/myapp.git' is not a git command. See 'git --help'." .. what?!

EDIT: RAAAGE!!

I'm having the same problem again, but now with 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

I've tried GUI push, and shows the same message.

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

Here's the currents .bashrc:

C:Users vc.bashrc (I think this is used only by 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:SSHhome vc.bashrc (.. and this is used when git connects via ssh to the "remote" server):

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}

EDIT 2: Some additional info:

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'.


EDIT 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

Has this did the trick??

git push is running 'git-receive-pack', and it should be 'git receive-pack' ?

My git version is 'git version 1.7.0.2.msysgit.0'

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

stupid fix (this changed /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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...