【发布时间】:2018-12-10 12:10:04
【问题描述】:
我正在尝试在我的 ovh 服务器上设置一个裸露的远程 git 存储库。当我尝试推送时,出现以下错误:
fatal: '/git/repo.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
到目前为止,我已经尝试了所有方法,包括 stackoverflow 上的每个帖子
- 我设置了私钥/公钥。这似乎不是问题。如果我尝试使用无效的密钥,则消息不一样
- 我已尝试直接从服务器上的存储库推送,它可以正常工作
- 我已尝试将服务器上的 chmod 设置为 777。没有变化
- 我已尝试更改 ssh 代理,消息相同
-
这是我的 git 配置文件
[remote "origin"] url = ssh://username@ssh.cluster014.ovh.net:/git/repo.git fetch = +refs/heads/*:refs/remotes/origin/* puttykeyfile = D:\\Dev\\ovh-git.ppk
我认为这是服务器配置问题,因为我可以从服务器上的服务器推送。
注意:
- 在服务器上,git版本是
2.1.4,我本地版本是2.18.0 - 我已经尝试过以下 SO 帖子
您能给我一些意见以找到出路吗?
编辑:
这是存储库上ls -ld 的输出
drwxr-xr-x+ 7 username users 10 juil. 2 08:45 git/repo.git/
【问题讨论】:
-
您是如何(您运行了哪些特定命令)在您的服务器上创建了 git 存储库的?服务器上
ls -ld /git/repo.git的输出是什么? -
我用
ls -ld的输出更新了答案。我使用命令git init --bare创建了存储库 -
这里的问题显然与路径名有关。请注意,当您 ssh 进入时,apparent 根目录从用户的主目录开始,而不是实际的根目录。例如,如果您将
username@...的主目录设置为/git,则相应的URL 将是ssh://username@host/repo.git。 -
谢谢@Torek,我得出了同样的结论。我尝试使用
/homez.166/user/git/repo.git而不是/git/repo.git,它成功了。万岁!我花了 3 天时间进行 svn 迁移。非常感谢这最后一步!
标签: git ssh git-remote