0

我正在尝试实现一个简单的场景,其中我在一台服务器上有一个 git repo,并且我能够将此 repo 推送到远程服务器。在解决了许多其他问题后,我陷入了以下阶段:

在 server1 上,我有一个 git repo。现在我按照http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/中列出的步骤进行操作

即 1) ssh 到远程服务器 2) 创建目录 3) 裸初始化 repo 4) 退出并在本地服务器上使用以下语句添加远程

   git remote add api User@example.com:/Myproj.git

5)推送到远程。(git push -u api 大师)

我得到的错误是

git: '/Myproj.git' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly

如何解决这个问题?我正在使用 MsysGit 1.7.10,并且两台服务器上的 ssh 服务器都是 Cygwin。

========================

添加 GIT_TRACE=2 git push -u api master 的输出

$ GIT_TRACE=2 git push -u api master
trace: built-in: git 'push' '-u' 'api' 'master'
trace: run_command: 'ssh' 'Administrator@api.example.com' 'git-receive-pack '\''
/Myproj.git'\'''
git: '/Myproj.git' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly

=======================

GIT_TRACE=2 git push -u api master 的输出(在进行全局 git 配置更改之后)

$ GIT_TRACE=2 git push -u api master trace: 内置: git 'push' '-u' 'api' 'master' trace: run_command: 'ssh' 'Administrator@api.example.com' 'git receive- pack '\'' /MyProj.git'\''' 致命:'/MyProj.git' 似乎不是 git 存储库 致命:远程端意外挂断

4

1 回答 1

2

我认为您只需要删除斜线并运行:

git remote add api User@example.com:Myproj.git
于 2012-07-23T19:32:18.513 回答