Git远程添加不起作用

izb*_*izb 4 windows ssh git msysgit

我正在尝试从我的 git bash 提示符添加一个远程服务器,例如:

git remote add origin ssh://myserver.pair.com/usr/home/myname/myrepo.git

fatal: Not a git repository (or any of the parent directories): .git
Run Code Online (Sandbox Code Playgroud)

我似乎已经设置好了 ssh,因为这...

ssh myserver.pair.com
Run Code Online (Sandbox Code Playgroud)

... 登录就好了,没有提示我输入密码。

远程添加似乎发生的事情是它甚至不尝试联系服务器。它立即返回错误,并且我为服务器名称设置的内容似乎无关紧要:

git remote add origin ssh://blahblahblah/usr/home/myname/myrepo.git

fatal: Not a git repository (or any of the parent directories): .git
Run Code Online (Sandbox Code Playgroud)

我是否以某种方式错误配置了 git?

技术细节:Windows Vista、MsysGit v1.6.4、SSH 配置文件 C:\Program Files\Git\etc\ssh\ssh_config

Xan*_*ndy 16

致命:不是 git 存储库(或任何父目录):.git

这告诉您您所在的目录不是 git 存储库。在添加远程服务器之前,提交内容,因此您必须创建一个 git 存储库。

在 git 存储库中有一个名为 .gitignore 的目录(可以隐藏).git。它包含有关存储库的元数据以及有关已检查文件的所有数据。

要创建它,请键入git init您希望拥有 git 存储库的目录。然后您可以添加远程服务器并对其执行操作。