简体   繁体   English

Git:推送到远程服务器失败,'REPOSITORY_PATH'不是git命令

[英]Git : Failed at pushing to remote server, ' REPOSITORY_PATH ' is not a git command

I'm using Git with TortoiseGit on Windows XP, and I have a remote bare repository on Windows Vista 64bit version. 我在Windows XP上使用Git和TortoiseGit,我在Windows Vista 64bit版本上有一个远程裸存储库。

When I tried to push my local files to remote bare repository, I got the following error message. 当我尝试将本地文件推送到远程裸存储库时,我收到以下错误消息。

git.exe push    "origin" master:master

git: '/Git_Repository/.git' is not a git command. See 'git --help'.

fatal: The remote end hung up unexpectedly

the arbitrary URL is : username@serverip:/Git_Repository/.git 任意URL是:username @ serverip:/Git_Repository/.git

The same arbitrary URL worked just fine while doing clone/fetch/pull. 在执行clone / fetch / pull时,相同的任意URL工作得很好。

Access from a local directory in remote machine to this bare repository has no problem either so I belive there is something wrong with my path. 从远程机器中的本地目录访问这个裸存储库也没有问题所以我相信我的路径有问题。

I can push/pull at GitHub correctly but I was using URL provide by GitHub. 我可以正确地推送/拉取GitHub,但我使用的是GitHub提供的URL。

Does anyone know what's wrong with my configuration? 有谁知道我的配置有什么问题?

Here is my remote .git/config 这是我的远程.git / config

[core]
repositoryformatversion = 0
filemode = false
bare = true
logallrefupdates = true
ignorecase = true
hideDotFiles = dotGitOnly

Here is my local .git/config 这是我的本地.git / config

[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
fetch = +refs/heads
url = username@serverip:/Git_Repository/.git
[branch "master"]
remote = origin
merge = refs/heads/master

I edited the URL to make it more precise,but it still show the same error 我编辑了URL以使其更精确,但它仍然显示相同的错误

Even more, no matter what I type after the serverip, it still shows the same error message 更重要的是,无论我在serverip之后输入什么,它仍然显示相同的错误消息

if the URL is 如果URL是

ssh://user@server ip/Git_Repositorywrongname/.git ssh:// user @ server ip / Git_Repositorywrongname / .git

then the error message 然后是错误信息

git: '/Git_Repositorywrongname/.git' is not a git command. git:'/ Git_Repositorywrongname/.git'不是git命令。 See 'git --help'. 见'git --help'。

When user connects to the remote repository, the executed git commands are from bin directories in SSH. 当用户连接到远程存储库时,执行的git命令来自SSH中的bin目录。 So I believe therer is wrong with my SSH configuration and this is why I can do git operations normally in local/ local in the remote machine. 所以我认为我的SSH配置有问题,这就是为什么我可以在远程机器的本地/本地正常进行git操作。

I followed the guide in http://code.google.com/p/tortoisegit/wiki/HOWTO_CentralServerWindowsXP and linked the 4 commands 我按照http://code.google.com/p/tortoisegit/wiki/HOWTO_CentralServerWindowsXP中的指南进行了操作并链接了4个命令

Did I miss anything? 我错过了什么吗?

Thanks for your reading 谢谢你的阅读

Solved! 解决了!

Run this command locally: 在本地运行此命令:

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

and then inside the local repo just run 然后在本地仓库里面运行

git push origin master

Alternately you can append the recieveoack command to every push 或者,您可以将recieveoack命令附加到每次推送

git push --receive-pack='git receive-pack'

Try specifying the protocol explicitly (here ssh), avoiding using the ':' between the user@host part, and the local path (look at the urls described in the git fetch man page ): 尝试显式指定协议(此处为ssh),避免在user @ host部分和本地路径之间使用':'(查看git fetch手册页中描述的URL):

url = ssh://username@serverip/C:/Git_Repository/.git

In other words, avoid the scp syntax for this kind of path. 换句话说,避免使用这种路径的scp语法

关于什么

git push file:///\\<machine-ip>/<share-remote-repo>/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM