2010-04-29 33 views
10

Tôi đã "thiết lập-a-msysgit-máy chủ-với-copssh-trên-windows", theo Tim Davis 'guide và bây giờ tôi đang học cách sử dụng lệnh git, theo sau guide của Jason Meridth và Tôi đã quản lý để có được tất cả mọi thứ làm việc tốt, nhưng bây giờ tôi không thể vượt qua lệnh push.GIT: clone hoạt động, đẩy từ xa không. Kho lưu trữ từ xa trên copssh

Tôi đã đặt máy chủ và ứng dụng khách trên cùng một máy (hiện tại), win7-x64.

Dưới đây là một số thông tin về cách mọi thứ được thiết lập:

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 

Tại '/SSH/home/rvc/.bashrc' và '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} 

Vì vậy, nhân bản tác phẩm (tất cả mọi thứ dưới đây được thực hiện thông qua "Git Bash here": 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] /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) 

Sau đó, tôi tạo ra một tập tin:

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

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

Cố gắng đẩy nó và nhận được lỗi này:

[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 

"git: '/SSH/home/rvc/myapp.git' không phải là một lệnh git. Xem 'git --help' ".. Cái gì ?!

EDIT:. RAAAGE !!

Tôi đang gặp vấn đề tương tự một lần nữa, nhưng bây giờ với 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 
.

tôi đã thử GUI đẩy, và hiển thị cùng một thông điệp

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 

Dưới đây là các dòng .bashrc:

C: \ Users \ rvc.bashrc (Tôi nghĩ rằng đây chỉ được sử dụng bởi 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 (.. và điều này được sử dụng khi git kết nối qua ssh đến máy chủ "từ xa"):

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: Một số thông tin bổ sung:

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


EDIT 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 

Có này đã làm các trick ??

git push đang chạy 'git-receive-pack' và nó phải là 'git receive-pack'?

Phiên bản git của tôi là 'git phiên bản 1.7.0.2.msysgit.0 '

Trả lời

11

sửa chữa ngu ngốc (điều này đã thay đổi /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) thường gây ra sự cố này - Mở cửa sổ Git Bash và nhập echo $HOME - đảm bảo nó được đặt thành /c/SSH/Home/<user>/. Nếu nó không phải là - nhập export HOME=/c/SSH/home/<user>

2) thử giao diện GUI

1

Tìm thấy các 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.

Tôi chỉ phải xóa var GIT_SSH từ cửa sổ [cùng prob?] biến môi trường.

Tôi đã thiết lập vì tôi đã làm theo hướng dẫn của Tim Davis, nhưng không sử dụng TortoiseGit, và hướng dẫn nói để trỏ biến tới TortoisePlink (bước 4.4), vì vậy tôi cho rằng tôi đã phải .exe: P. O cũng .. chuyển sang vấn đề tiếp theo ...

1

Cảm ơn bạn! Tôi cũng gặp lỗi

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

lệnh git config đã hoạt động đối với tôi.

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

Tôi đang chạy MSysGit-1.7.3.1

Các vấn đề liên quan