2010-04-29 106 views
10

我在Tim Davis的guide之後「setup-a-msysgit-server-with-copssh-on-windows」,我正在學習如何使用git命令,跟隨Jason Meridth的guide,以及我設法讓一切正常工作,但現在我無法通過push命令。GIT:克隆工程,遠程推送不。遠程存儲庫通過copssh

我已經將服務器和客戶端設置在同一臺機器上(現在),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' 和 '用戶/ 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} 

因此,克隆作品(一切波紋管是通過 「混帳擊這裏」 做了:P):

[email protected] /c/code 
$ git clone ssh://[email protected]:5858/SSH/home/rvc/myapp.git 
Initialized empty Git repository in C:/code/myapp/.git/ 
warning: You appear to have cloned an empty repository. 

[email protected] /c/code 
$ cd myapp 

[email protected]DESKTOP /c/code/myapp (master) 
$ git remote -v 
origin ssh://[email protected]:5858/SSH/home/rvc/myapp.git (fetch) 
origin ssh://[email protected]:5858/SSH/home/rvc/myapp.git (push) 

然後我創建了一個文件:

[email protected] /c/code/myapp (master) 
$ touch test.file 

[email protected] /c/code/myapp (master) 
$ ls 
test.file 

努力推動,並得到這個錯誤:

[email protected] /c/code/myapp (master) 
$ git add test.file 

[email protected] /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] 
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 

「混帳: '/SSH/home/rvc/myapp.git' 不是一個git命令。見 '的git --help'「..什麼?

編輯: RAAAGE!

我再有同樣的問題,但現在使用ssh:

[email protected] /c/code/myapp (master) 
$ GIT_TRACE=1 git push 
trace: built-in: git 'push' 
trace: run_command: 'ssh' '-p' '5858' '[email protected]' '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]:5858/SSH/home/rvc/myapp.git 
fatal: The remote end hung up unexpectedly 

這裏的電流的.bashrc:

C:\用戶\ rvc.bashrc(我想這隻能由Cygwin的/ bash的git的使用):

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 \家\ rvc.bashrc(..,這是用來當混帳通過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: 一些附加信息:

[email protected] /c/code/myapp (master) 
$ ssh -p 5858 [email protected] git-receive-pack /SSH/home/rvc/myapp.git 
git: '/SSH/home/rvc/myapp.git' is not a git command. See 'git --help'. 


編輯3:

[email protected] /c/code/myapp (master) 
$ git push --receive-pack='git receive-pack' ssh://[email protected]: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]: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'

回答

11

愚蠢的修復(這改變了/SSH/home/rvc/.gitconfig):

[email protected] /c/code/myapp (master) 
$ git config --global remote.origin.receivepack "git receive-pack" 

[email protected] /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://[email protected]:5858/SSH/home/rvc/myapp.git 
    680f32e..2da0df1 master -> master 
1

1)最常見原因 - 打開Git Bash窗口並輸入echo $HOME - 確保它設置爲/c/SSH/Home/<user>/。如果不是 - 輸入export HOME=/c/SSH/home/<user>

2)儘量GUI界面

1

找到了answer ...

GIT_SSH

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

use this command instead of ssh when they need to connect to a remote system. The $GIT_SSH command will be given exactly two arguments: the [email protected] (or just host) from the URL and the shell command to execute on that remote system.

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

will need to wrap the program and options into a shell script, then set GIT_SSH to refer to the shell script.

Usually it is easier to configure any desired options through your 

personal .ssh/config file. Please consult your ssh documentation for further details.

我不得不刪除從窗戶GIT_SSH VAR [相同的概率?]環境變量。

我已經受夠了設置,因爲我下面添戴維斯的指導,但不使用TortoiseGit, 和導說給變量指向的TortoisePlink(步驟4.4),所以我認爲我不得不 指出砰砰.exe:P。不過,噢..移動到下一個問題......

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

相關問題