克隆有效,远程推送无效。通过 copssh 的远程存储库

发布于 2024-08-30 22:16:02 字数 5321 浏览 10 评论 0原文

我按照 Tim Davis 的 指南,我现在正在学习如何使用 git 命令,遵循 Jason Meridth 的 指南,我已经设法让一切正常工作,但现在我无法通过推送命令。

我已经将服务器和客户端设置在同一台机器上(目前),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]: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]:5858/SSH/home/rvc/myapp.git (fetch)
origin  ssh://[email protected]: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]
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'。” .. 什么?!

编辑: 拉阿吉!

我再次遇到同样的问题,但现在使用 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]' '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:\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 [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:

rvc@RVC-DESKTOP /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 版本 1.7.0.2.msysgit.0”

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://[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.

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

rvc@RVC-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)

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

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://[email protected]:5858/SSH/home/rvc/myapp.git
fatal: The remote end hung up unexpectedly

Here's the currents .bashrc:

C:\Users\rvc.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:\SSH\home\rvc.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 [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:

rvc@RVC-DESKTOP /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

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'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小苏打饼 2024-09-06 22:16:02

愚蠢的修复(这改变了/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://[email protected]:5858/SSH/home/rvc/myapp.git
   680f32e..2da0df1  master -> master

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://[email protected]:5858/SSH/home/rvc/myapp.git
   680f32e..2da0df1  master -> master
猫腻 2024-09-06 22:16:02

找到答案...

GIT_SSH

如果设置了这个环境变量,那么 git fetch 和 git push 将

当以下情况时使用此命令而不是 ssh
他们需要连接到远程
系统。 $GIT_SSH 命令将是
恰好给出两个参数:
用户名@主机(或只是主机)
URL 和要执行的 shell 命令
在该远程系统上。

要将选项传递给要在 GIT_SSH 中列出的程序,您需要

需要包装程序并且
将选项写入 shell 脚本,然后设置
GIT_SSH 引用 shell 脚本。

通常,通过您的配置更容易配置任何所需的选项

个人.ssh/config 文件。请
请参阅您的 ssh 文档
更多详细信息。

我只需从 Windows 环境变量中删除 GIT_SSH var 即可。

我已经设置了它,因为我遵循 Tim Davis 的指南,但没有使用 TortoiseGit,
指南说将变量指向 TortoisePlink (步骤 4.4),所以我认为我必须
指向 plink.exe :P。哦,好吧......转向下一个问题......

Found the 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
username@host (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.

I just had to delete the GIT_SSH var from the windows environment variables.

I've had it set because I was following Tim Davis' guide, but without using TortoiseGit,
and the guide says to point the variable to TortoisePlink (step 4.4), so I assumed I had to
pointed to plink.exe :P. O well.. moving to the next problem...

无畏 2024-09-06 22:16:02

谢谢你! 错误

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

Thank you! I was also getting the error

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

the git config command worked for me.

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

I am running MSysGit-1.7.3.1

莫言歌 2024-09-06 22:16:02

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

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

1) most often cause of this prob - Open a Git Bash window and type echo $HOME – ensure it is set to /c/SSH/Home/<user>/. If it is not – enter export HOME=/c/SSH/home/<user>

2) try the GUI interface [same prob?]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文