【问题标题】:GIT - '~/repo.git/' is not a git commandGIT - '~/repo.git/' 不是 git 命令
【发布时间】:2011-12-08 07:42:06
【问题描述】:

我对远程 git repo 和本地 repo(使用 SmartGit)有疑问。

我正在通过 ssh 在我的服务器上创建远程仓库:

> cd ~
> git init repo.git
> cd repo.git
> touch readme
> git add .
> git commit -m "Initial commit"

从这里开始,一切似乎都很完美。现在我正在尝试使用带有命令的 Smartgit 克隆 repo

ssh://user@server:22/~/repo.git

一切都克隆得很好。我在自述文件中进行了更改,保存它并尝试提交和推送并收到错误:

The remote end hang up unexpectedly
git: '~/repo.git' is not a git command. See 'git --help'

我做错了什么? 谢谢。

【问题讨论】:

    标签: git smartgit


    【解决方案1】:

    用途:

    GIT_TRACE=2 git push origin master
    

    看看发生了什么来调试问题。

    更新:

    正在尝试git-receive-pack

    尝试以下操作:

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

    然后再次推送。

    您可以尝试的其他方法:

    在远程服务器上设置一个裸仓库:

    git init --bare
    

    然后尝试克隆并推送到它。

    【讨论】:

    • 在 SmartGit 中哪里可以做到这一点?
    • @bender.rodriges - 更新了我的答案。
    【解决方案2】:

    我建议使用完整路径而不是主页快捷方式 (~),例如 git clone ssh://user@server/home/tuergeist/repo

    这适用于我在 linux 和 WindowsXP 上的 git bash。

    您还应该忽略 .git 扩展名,这可能会混淆您的工具,因为它需要一个裸存储库。 (但我不确定)

    【讨论】:

      【解决方案3】:

      您不需要指定端口 22;这是 SSH 的默认端口。此外,如果您指定 user@server:path,则默认使用 SSH。

      尝试仅使用...进行克隆

      user@server:~/repo.git
      

      改为。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-04-24
        • 2015-04-26
        • 2019-07-05
        • 2023-02-21
        • 2012-11-24
        • 2019-01-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多