我在 Windows XP 上使用 Git 和 TortoiseGit, 我在 Windows Vista 64 位版本上有一个远程裸存储库。
当我尝试将我的本地文件推送到远程裸存储库时,我收到以下错误消息。
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
任意 URL 是:username@serverip:/Git_Repository/.git
相同的任意 URL 在执行克隆/获取/pull 时工作得很好。
从远程机器的本地目录访问这个裸存储库也没有问题,所以我相信我的路径有问题。
我可以在 GitHub 上正确地推送/pull ,但我使用的是 GitHub 提供的 URL。
有人知道我的配置有什么问题吗?
这是我的远程 .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = true
logallrefupdates = true
ignorecase = true
hideDotFiles = dotGitOnly
这是我本地的.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
我修改了网址使其更准确,但它仍然显示相同的错误
更重要的是,无论我在serverip后面输入什么,它仍然显示相同的错误信息
如果网址是
ssh://user@server ip/Git_Repositorywrongname/.git
然后是错误信息
git: '/Git_Repositorywrongname/.git' is not a git command. See 'git --help'.
当用户连接到远程仓库时,执行的 git 命令来自 SSH 中的 bin 目录。所以我相信我的 SSH 配置有问题,这就是为什么我可以在远程计算机的本地/本地正常执行 git 操作的原因。
我遵循了 http://code.google.com/p/tortoisegit/wiki/HOWTO_CentralServerWindowsXP 中的指南并链接了 4 个命令
我错过了什么吗?
感谢您的阅读
最佳答案
解决了!
在本地运行这个命令:
git config --global remote.origin.receivepack "git receive-pack"
然后在本地仓库中运行
git push origin master
或者,您可以将 recieveoack 命令附加到每个推送
git push --receive-pack='git receive-pack'
关于Git : Failed at pushing to remote server, ' REPOSITORY_PATH ' 不是git命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2550422/