I have set git daemon on my server to have my personal git repo following the official documentation. Altho it seems that the --base-path
does not work as intended, or as specified in the description.
I want to be able to clone a repo as: git clone [email protected]:path/to/repo.git
without having to specify git clone [email protected]:/where/git/user/home/is/path/to/repo.git
My git daemon service is as follow:
/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):
git init --bare gns/api.git
Locally when I try to clone it I have an error:
┌──(kali㉿kali)-[~]
└─$ git clone [email protected]: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 [email protected]: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
CodePudding user response:
From what I know of the Git daemon, this is for serving repositories using the “Git” protocol.
Meaning URLs starting with 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.
That would mean the daemon would not be used with such URLs.