[英]Git server with git daemon seem to not care about --base-path
I have set git daemon on my server to have my personal git repo following the official documentation.我已经在我的服务器上设置了 git 守护进程,以便按照官方文档拥有我的个人 git repo。 Altho it seems that the --base-path
does not work as intended, or as specified in the description.尽管如此, --base-path
似乎无法按预期或描述中指定的方式工作。
I want to be able to clone a repo as: git clone git@myserver.com:path/to/repo.git
without having to specify git clone git@myserver.com:/where/git/user/home/is/path/to/repo.git
我希望能够将 repo 克隆为: git clone git@myserver.com:path/to/repo.git
而不必指定git clone git@myserver.com:/where/git/user/home/is/path/to/repo.git
My git daemon service is as follow:我的 git 守护进程服务如下:
/usr/bin/git daemon --export-all --reuseaddr --base-path=/home/git/data/ /home/git/data/
Then I created a base repo in /home/git/data/gns/
( gns
is like a 'group' where I will have few repos):然后我在/home/git/data/gns/
中创建了一个基本仓库( gns
就像一个“组”,我将有几个仓库):
git init --bare gns/api.git
Locally when I try to clone it I have an error:在本地,当我尝试克隆它时出现错误:
┌──(kali㉿kali)-[~]
└─$ git clone git@myserver.com:gns/api.git
Cloning into 'api'...
Enter passphrase for key '/home/kali/.ssh/id_ed25519':
fatal: 'gns/api.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.
But where it's interesting is that this one works (?!):但有趣的是这个工作(?!):
┌──(kali㉿kali)-[~]
└─$ git clone git@myserver.com:data/gns/api.git
Cloning into 'api'...
Enter passphrase for key '/home/kali/.ssh/id_ed25519':
warning: You appear to have cloned an empty repository.
Any idea what is going on?知道发生了什么吗? Why with data/ it works?为什么使用数据/它有效? And what do I miss to make it correctly?我错过了什么才能正确地做到这一点?
thanks谢谢
From what I know of the Git daemon , this is for serving repositories using the “Git” protocol.根据我对Git 守护进程的了解,这是用于使用“Git”协议为存储库提供服务。
Meaning URLs starting with git://...
表示以git://...
But you are not using such URLs, you are using SSH URLs, connecting to myserver.com
with the remote user git
, in which home ( /home/git
) there is a data/gns/api.git
folder.但是您没有使用此类 URL,而是使用 SSH URL,使用远程用户git
连接到myserver.com
,其中 home ( /home/git
) 有一个data/gns/api.git
文件夹。
That would mean the daemon would not be used with such URLs.这意味着守护程序不会与此类 URL 一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.