git push origin master:'D:/ Projects / TheProject'不是git命令

时间:2011-04-26 18:48:40

标签: git cygwin msysgit

我有两台机器用msysgit运行cygwin ssh。我按照'X' does not appear to be a git repository (I'm sure the path is correct)中的描述从我的桌面克隆了一个git存储库到我的笔记本电脑。这给我留下了一个.git / config,如下所示:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = GitServer:D:/Projects/TheProject
[branch "master"]
    remote = origin
    merge = refs/heads/master

克隆效果很好。 git pull起源很棒。但如果我尝试“git push origin master”,我会收到以下错误:

$ git push origin master
MyUser@TheDesktop's password:
git: 'D:/Projects/TheProject' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly

关于修复此问题的任何想法?

5 个答案:

答案 0 :(得分:2)

http://www.cygwin.com/cygwin-ug-net/using.html#cygdrive建议不要使用“D:/”语法,建议改用“/ cygdrive / d /”。

看起来cygwin没有chsh,但您可以在git-shell中手动将shell设置为cygwin.bat

答案 1 :(得分:1)

您可以使用cygwin网址:使用/ d / Projects / TheProject代替D:/ Projects / TheProject

答案 2 :(得分:1)

this question接受的答案为我解决了这个问题,特别是:

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

答案 3 :(得分:1)

首先在客户端运行:     git config --global remote.origin.receivepack "git receive-pack"

CD到您的本地存储库:     cd mylocalrepo

假设服务器端路径== c:\ gitpub \ myproj.git,然后拉/推到服务器     git fetch user@remoteserver.com:c:/gitpub/myproj.git master     git push user@remoteserver.com:c:/gitpub/myproj.git master

当然你可以添加一个远程快捷方式:     git remote add myremote user@remoteserver.com:c:/gitpub/myproj.git

然后:     git fetch myremote master     git push myremote master

有关cygwin / ssh服务器设置的更多信息,这里有一篇文章讨论在Amazon EC2云中运行的Windows Server实例上设置共享GIT存储库:

http://cacheattack.blogspot.com/2012/05/installing-git-server-on-amazon-ec2.html

答案 4 :(得分:0)

我已经转而使用cygwin的git版本,正如ak2的评论中提到的那样。这一切现在都有效。

但我确实记得为什么我首先避免使用cygwin git ...当使用git svn时经常(每天几次)错误。我最终不得不杀死我所有的cygwin进程并运行“ash rebaseall”来修复它,或者重启我的机器。这非常令人沮丧。