0

我对远程 git 存储库和本地存储库(使用 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'

我究竟做错了什么?谢谢你。

4

3 回答 3

2

采用:

GIT_TRACE=2 git push origin master

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

更新:

它正在尝试git-receive-pack

尝试执行以下操作:

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

然后再次推动。

您可以尝试的其他事情:

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

git init --bare

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

于 2011-12-08T07:51:19.397 回答
1

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

这适用于我在 linux 上以及在 git bash 中的 Windows XP 上。

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

于 2011-12-08T09:18:25.377 回答
0

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

尝试克隆...

user@server:~/repo.git

反而。

于 2011-12-08T07:48:48.200 回答