我按照 Tim Davis 的方法“setup-a-msysgit-server-with-copssh-on-windows”guide http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/我现在正在学习如何使用 git 命令,遵循 Jason Meridth 的guide http://www.lostechies.com/blogs/jason_meridth/archive/2009/06/04/git-for-windows-developers-git-series-part-2.aspx,我已经设法让一切正常工作,但现在我无法通过推送命令。
我已经将服务器和客户端设置在同一台机器上(目前),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 here”完成的:P):
rvc@RVC-DESKTOP /c/code
$ git clone ssh://[email protected] /cdn-cgi/l/email-protection: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://[email protected] /cdn-cgi/l/email-protection:5858/SSH/home/rvc/myapp.git (fetch)
origin ssh://[email protected] /cdn-cgi/l/email-protection: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' '[email protected] /cdn-cgi/l/email-protection
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' 不是 git 命令。请参阅 'git --help'。” .. 什么?!
EDIT:拉阿吉!
我又遇到了同样的问题,但现在使用 ssh:
rvc@RVC-DESKTOP /c/code/myapp (master)
$ GIT_TRACE=1 git push
trace: built-in: git 'push'
trace: run_command: 'ssh' '-p' '5858' '[email protected] /cdn-cgi/l/email-protection' '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://[email protected] /cdn-cgi/l/email-protection: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}
EDIT 2:一些附加信息:
rvc@RVC-DESKTOP /c/code/myapp (master)
$ ssh -p 5858 [email protected] /cdn-cgi/l/email-protection 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://[email protected] /cdn-cgi/l/email-protection: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://[email protected] /cdn-cgi/l/email-protection:5858/SSH/home/rvc/myapp.git
* [new branch] master -> master
这招有用吗??
git push 正在运行“git-receive-pack”,它应该是“git receive-pack”?
我的 git 版本是“git 版本 1.7.0.2.msysgit.0”