【发布时间】:2015-03-14 03:00:54
【问题描述】:
这是我在服务器 (iMac) 中所做的:
- 我创建了“repo”目录,以包含我所有的 .git 项目。
- 我将其设为当前目录并在终端中使用以下命令:
>
$ mkdir test.git
$ cd test.git
$ git init --bare
- 我已导出 .pub 文件并将其添加到服务器中,以便能够使用 ssh 进行连接。
-
我已经使用以下命令测试了连接:
$ ssh 192.168.1.1
MacBook 能够完美连接到服务器。
-
我在终端中使用了这些命令:
$ cd project.git
$ git remote add origin ssh://192.168.1.1:~/repo/test.git
$ git push --all
-
我收到了这条消息:
致命:'/repo/test.git' 似乎不是 git 存储库
致命:无法从远程存储库读取。
请确保您拥有正确的访问权限
并且存储库存在。
【问题讨论】:
-
你在 git repo 中添加了什么并提交了吗?
-
试试
git remote add origin user@192.168.1.1:~/repo/test.git -
@Jayan 我有一个本地项目,我想将它推送到服务器。我不想直接从 repo 提交。
-
@NikhilSupekar 我试过了。没用
-
另一个建议:提供test.git的绝对路径并再次检查。
标签: git ssh terminal ssh-keys osx-server